GithubHelp home page GithubHelp logo

types-gjs's Introduction

types-gjs's People

Contributors

gr3q avatar jonath92 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

types-gjs's Issues

Mention the limits on Readme

Some things just can't be correctly typed due to limits/weird behavior in GJS. I think it would be great to mention this on the readme. Two things I have in mind:

  • The types let you wrongly extend GOjbect classes
  • The types allow you to pass an "undefined" value for a property, e.g. I got the following error :

Invalid value 'undefined' for property text in object initializer.
For this code snippet:

    const label = new Label({
       ....
        text: getcurrentChannel()?.name // getCurrentChannel can be undefined 
    })

Types wrongly allow to pass readonly props to constructor

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.

[Feature Request] Use ES6 Module

The way of importing CJS or GJS module is very special and very uncommon nowadays. It is much more common to use ES6 Modules. The most annoying thing of the GJS variant, is that I don't get any auto suggestion from my IDE (VSC) when I type something.:

image

Ideally the IDE would suggest me to import Label from gi/St. With externals we can map globals to modules in webpack, e.g. instead of "importing" the Label constructor with the help of object destructuring of imports.gi.St we can import it from gi/St (see https://stackoverflow.com/a/45239697/11603006). But only changing the settings in webpack is not sufficient as this doesn't help us to get the correct types. I tried a little bit to achieve this by changing some settings in the tsconfig but AFAICS this is not possible (although I might be wrong). I think the only way to achieve this is to change the types directly which I guess is thanks to your generator not that difficult.

I haven't yet spent any time on your generator and it doesn't have the highest priority for me at the moment. So I really would love to see that feature but I am not willing to implement at my own in the foreseeable future. What do you think @Gr3q?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.