Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with GLib Variant types #239

Closed
1 of 3 tasks
flexagoon opened this issue Feb 17, 2025 · 4 comments · Fixed by #240
Closed
1 of 3 tasks

Issue with GLib Variant types #239

flexagoon opened this issue Feb 17, 2025 · 4 comments · Fixed by #240
Labels

Comments

@flexagoon
Copy link

Description

For some reason, GLib types that used to work now throw an error

Current vs Expected Behavior

Current:

let dbus = Gio.DBusExportedObject.wrapJSObject("...", this);
dbus.emit_signal('picked', new GLib.Variant('(s)', [wmClass]));
1. Argument of type 'Variant<"(s)">' is not assignable to parameter of type 'Variant<any>'.
     The types returned by '_init(...)' are incompatible between these types.
       Type 'void' is not assignable to type 'Variant<any>'. [2345]

Another example:

let prefs = this.getSetings() // In an 
let variant = new GLib.Variant('s', value);
prefs.set_value('foo', variant);
Diagnostics:
1. Argument of type 'import("/var/home/flexagoon/Documents/Code/rounded-window-corners/node_modules/@girs/glib-2.0/glib-2.0").GLib.Variant<any>' is not assignable to parameter of type 'import("/var/home/flexagoon/Documents/Code/rounded-window-corners/node_modules/@girs/gnome-shell/node_modules/@girs/glib-2.0/glib-2.0").GLib.Variant<any>'.
     The types returned by '_init(...)' are incompatible between these types.
       Type 'void' is not assignable to type 'Variant<any>'. [2345]

Expected:
It shouldn't throw an error

Additional Context

  • This affects other GJS types/classes
  • This is a regression from a previous version
  • This blocks other functionality
@JumpLink
Copy link
Collaborator

@flexagoon I have adapted an existing example with #240 to reproduce your issue with it and I don't have the problem, so I suspect that you have different versions of @girs/glib-2.0 installed. To prevent this, it helps to use the same ts-for-gir version for all dependencies, e.g. x.x.x-4.0.0-beta.21

@flexagoon
Copy link
Author

@JumpLink I do have different versions of it installed, but I'm not sure how to fix it. It seems like some of the @girs/gjs dependencies depend on a different version, for example:

        "node_modules/@girs/accountsservice-1.0/node_modules/@girs/gio-2.0": {
            "version": "2.82.4-4.0.0-beta.20",
            "resolved": "https://registry.npmjs.org/@girs/gio-2.0/-/gio-2.0-2.82.4-4.0.0-beta.20.tgz",
            "integrity": "sha512-w9Bu0uLv0ikSgXwnS/Gtsf+daOZBoMy+uD8lWAam4trq8rfYAfPUCGhFwhUqnkcF6TsF5+5z4N9RZADS4+IRqg==",
            "dev": true,
            "license": "MIT",
            "dependencies": {
                "@girs/gjs": "^4.0.0-beta.20",
                "@girs/glib-2.0": "^2.82.4-4.0.0-beta.20",
                "@girs/gobject-2.0": "^2.82.4-4.0.0-beta.20"
            }
        },

https://github.com/flexagoon/rounded-window-corners/blob/main/package-lock.json

@flexagoon
Copy link
Author

@JumpLink looks like it's because gnome-shell types need to be updated to use beta.21 types

flexagoon added a commit to flexagoon/rounded-window-corners that referenced this issue Feb 18, 2025
@girs/gnome-shell is currently 1 version behind in its deps which causes
type conflicts.

gjsify/ts-for-gir#239
@JumpLink
Copy link
Collaborator

@flexagoon for this you can use the next types of gnome-shell wich are for the comming GNOME Shell 48 or instead you can use the types from the ts-for-gir beta-20 types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants