JSPM

  • Created
  • Published
  • Downloads 18667
  • Score
    100M100P100Q154630F
  • License MIT

GJS TypeScript type definitions for Gjs

Package Exports

  • @girs/gjs
  • @girs/gjs/ambient
  • @girs/gjs/cairo
  • @girs/gjs/gettext
  • @girs/gjs/system

Readme

Gjs

GJS TypeScript type definitions for Gjs using ts-for-gir v3.0.0-beta.15.

Install

To use this type definitions, install them with NPM:

npm install @girs/gjs

Usage

You can import this package into your project like this:

import Gjs from '@girs/gjs';

Or if you prefer CommonJS, you can also use this:

const Gjs = require('@girs/gjs');

Ambient Modules

You can import core ambient module types. For this you need to include the @girs/gjs or @girs/gjs/ambient in your tsconfig or entry point Typescript file:

index.ts:

import '@girs/gjs'

tsconfig.json:

{
  "compilerOptions": {
    ...
  },
  "include": ["@girs/gjs"],
  ...
}

Now you can import gettext and system in ESM style with Typescript support:

import gettext from 'gettext';
import system from 'system';

If you want to have more types for GIR modules, you have to add them to your dependencies and import them as well, see the description of these modules, e.g. Gtk-4.0.

Bundle

Depending on your project configuration, it is recommended to use a bundler like esbuild. You can find examples using different bundlers here.

Other packages

All existing pre-generated packages can be found on gjsify/types.