gjsify/ts-for-gir

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

YarnSphere opened this issue · 0 comments

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.