For example here I have gdk.Window and gtk4.Window. And I cant understand from this error why it doesn't work.
(You need to guess that you need a window from GDK and not GTK)

I think it should look like this:
required type for self: gtk4.Window
but expression 'window' is of type: gdk.Window