Gr3q / types-gjs

Typescript definitions for GJS - Gnome JavaScript
MIT License
7 stars 2 forks source link

Types wrongly allow to pass readonly props to constructor #7

Open jonath92 opened 2 years ago

jonath92 commented 2 years ago

It is a minor issue but worth to fix at some time in future:

Currently the types don't prevent me to write something like this:

const { Label } = imports.gi.St
const { Text } = imports.gi.Clutter

const label = new Label({
    visible: false,
    clutter_text: new Text({
        use_markup: true
    })
})

This is wrong because clutter_text is readonly. GJS is throwing the following error: [radio@driglu4it]: Property StLabel.clutter-text is not writable.

I haven't tested if this also effects other classes but as the types are auto generated I guess this to be the case.

Gr3q commented 2 years ago

Yeah, I had the assumption readonly props can be modified at init, but it's probably not the case.

I can change it, but it would be nice to confirm it with other readonly props/classes