Skip to content

A CLI tool using node-gir to generate TypeScript declaration files for GObject libraries

License

Notifications You must be signed in to change notification settings

Place1/gir-dts-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GIR DTS Generator (WIP)

This repository contains a CLI tool that uses node-gir to build TypeScript declaration files for GObject annotated libraries.

This project is a WIP. The goal is to provide automatic type declaration files for projects consuming GObject libraries through node-gir.

Usage

npm install -g gir-dts-generator
gir-dts-generator --help
Usage: gir-dts-generator [options] <libraryName> [libraryVersion]


Options:

  -V, --version        output the version number
  -o, --output <path>  A file to write the output to. Defaults to stdout
  -h, --help           output usage information

In Code

not sure yet

Roadmap

  • Add support for types that are used from other GObject libraries
    • Currently the declaration files are broken for most libs because classes that extend, or functions that use types from another library will reference undefined symbols. These symbols will have to be resolved and added as extra namespaces in the output declaration file.
  • Determine how generated declaration files should be used in code
    • currently the generated declaration file just exports a namespace but you can't use a namespace as a type. i.e. the following isn's legal typescript: const GtkLib = load('Gtk', '3.0') as Gtk where Gtk is the ambient namespace exported by the generated .d.ts
  • Determine the best way to integrate directly with node-gir
    • ideally, typescript users consuming node-gir should automatically get types namespace objects when they load('library'). node-gir could probably be a consumer of this tool and use this feature Place1/node-gir#8 to automatically type popular libraries.
  • Potentially add a flag --gjs-compat
    • this flag would make the tool output GJS compatible declarations. node-gir follow's NodeJS's camelCase naming conventions where as GJS uses snake_case.

About

A CLI tool using node-gir to generate TypeScript declaration files for GObject libraries

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published