Monday, February 27, 2017

Sorting out Gjs with Typescript

I get why Gnome wants to use javascript. I love the language. The thing is, I don't love Gnome's implementation.

The syntax is getting out of date, and my experience with other engines doesn't translate well to the Gjs environment. Combine this with a lack of documentation. If Gnome wants to attract javascript developers, this isn't the way to do it. Its not too bad when you are coding a one page demo widget, but try coding an ambitious desktop application. Without relevant api information, I'm coding blindfolded.

One solution would be to use Typescript. All I need to do is translate the *.gir metadata to *.d.ts format, so I've created a tool

All I have to do is install with npm, and reference the contained *.d.ts files.

There are a couple of samples in the example folder at

This tool was designed to facillitate the development of another application, so it's a great example of a Gjs/Typescript application:


  1. This comment has been removed by the author.

  2. Really good work. I agree wholeheartedly with your assertion that "If Gnome wants to attract javascript developers, this isn't the way to do it."

    And Typescript does look very appealing. Visual Studio Code, with your GTK typescript files, and therefore "intellisense" for the GTK libraries is really quite nice.

    One of the awkward things about GJS is how it handles modules. Have you looked into whether it is sane to try and support NodeJS (CommonJS I suppose) modules, and Typescript, with GJS?

  3. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from TypeScript Training in Chennai . or learn thru Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Training in Chennai