Using the GNOME Documentation, I wanted to write a demo of using webkit and GTK4 together in Vala by porting GTK3 code. However, when changing the library from gtk3 to gtk4, a crazy amount of errors occur, 2726 in total. Most of them are very similar, seeming like library conflicts, saying "error: `Gdk' already contains a definition for ...". It seems like Webkit2GTK is on version 4 in Vala, while in Rust there is a Version 5. It also seems like they had an Experimental flag to support GTK4, but you have to compile from source, and that was almost a year ago.
webkit2gtk is a library that integrates WebKit into GTK: webkit2gtk4 integrates with GTK3; webkit2gtk5 will work with GTK4. It isn't ready yet however, so that's why it's an experimental flag still at this point. Once webkit2gtk5 is out, you'll also have to wait until the Vala bindings are out.
In other words, the library/bindings you're using can't work with GTK4, as that's not what it's built for. That's why you have all those errors.