Node.js TypeScript type definitions for node-gtk using ts-for-gir v3.3.0.
node-gtk is a GObject Introspection import library for Node.js. Using node-gtk with the type definitions in this NPM package, you can build GTK applications in JavaScript or TypeScript with type checking, better autocompletion and inline documentations.
To use this type definitions, install them with NPM:
npm install @girs/node-gtk
You can import this package into your project like this:
import NodeGtk from '@girs/node-gtk';
Or if you prefer CommonJS, you can also use this:
const NodeGtk = require('@girs/node-gtk');
You can import core ambient module types.
For this you need to include the @girs/node-gtk
or @girs/node-gtk/ambient
in your tsconfig
or entry point Typescript file:
index.ts
:
import '@girs/node-gtk'
tsconfig.json
:
{
"compilerOptions": {
...
},
"include": ["@girs/node-gtk"],
...
}
Now you can import node-gtk
with Typescript support:
const gi = require('node-gtk');
gi.startLoop();
If you want to have types for GObject Introspection modules, you have to add them to your dependencies and import them as well, see the description of these modules, e.g. node-gtk-4.0, node-gio-2.0, node-adw-1 and much more.
Depending on your project configuration, it is recommended to use a bundler like esbuild. You can find examples using different bundlers here.
All existing pre-generated packages can be found on gjsify/types.