gtk-js-app icon indicating copy to clipboard operation
gtk-js-app copied to clipboard

Template for using GJS with TypeScript

Open louwers opened this issue 3 years ago • 3 comments

I am a complete newcomer to GTK & GJS development. I write TypeScript professionally and I prefer using TypeScript using plain JavaScript. I see that multiple GTK apps are written in TypeScript now.

One popular example is pop-os/shell, however that project does not use type definitions for GJS itself. It also uses quite a weird build setup with sed scripts.

Then I found ts-for-gir which seems to be the most mature library that provides types for GJS. They also have a lot of example projects. Meson is not used as a build tool for these example projects (esbuild is used instead for most).

It would be great to have a standard template for starting out GJS development that includes TypeScript.

louwers avatar Sep 17 '22 10:09 louwers

If you want an officially supported template from GNOME – I think several things need to happen

  1. “official” GJS types. This is more or less in progress https://www.npmjs.com/search?q=%40gi-types - perhaps @ewlsh could use help?
  2. Find out if we agree to use TypeScript in GNOME Core - @BrainBlasted is working on that as part of https://gitlab.gnome.org/GNOME/gnome-sound-recorder/-/merge_requests/191 (probably a good reference in the meantime)
  3. Add TypeScript template to GNOME Builder

sonnyp avatar Sep 17 '22 10:09 sonnyp

Ha and of course there is https://blogs.gnome.org/christopherdavis/2022/08/25/trying-typescript-for-gnome-apps/ as well

sonnyp avatar Sep 19 '22 19:09 sonnyp

Curious, has there been any progress / insight on this enhacement? I saw that there is https://gitlab.gnome.org/BrainBlasted/gnome-typescript-template but at least for me, it does not build correctly and requires quite a lot of dependencies for flatpak with node

Would be super if there was something a bit more minimal.

C-Loftus avatar Apr 30 '24 14:04 C-Loftus