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

Some nullable object properties are not marked as nullable by TS for GIR #156

Open
YarnSphere opened this issue Mar 17, 2024 · 0 comments
Open

Comments

@YarnSphere
Copy link

Looking at Gtk.Window as an example, I believe that the child and application properties should be nullable, see: get_child/set_child and get_application/set_application, where it explicitly states that NULL is a valid argument.

However, they're not defined as such in TS for GIR:

interface Window extends Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager {

    // Own properties of Gtk-4.0.Gtk.Window

    /**
     * The `GtkApplication` associated with the window.
     * 
     * The application will be kept alive for at least as long as it
     * has any windows associated with it (see g_application_hold()
     * for a way to keep it alive without windows).
     * 
     * Normally, the connection between the application and the window
     * will remain until the window is destroyed, but you can explicitly
     * remove it by setting the :application property to %NULL.
     */
    application: Application
    /**
     * The child widget.
     */
    child: Widget

In short, I believe that the following code should compile:

const window = new Gtk.Window();
window.application = null;
window.child = null;

The same issue exists with many other properties. From what I've noticed, the issue seems to exist mainly in properties that have a GObject type, but it might also exist in others.

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

No branches or pull requests

1 participant