@girs/gjs 3.0.0-beta.14 → 3.0.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
 
2
2
  # Gjs
3
3
 
4
- GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.0.0-beta.14.
4
+ GJS TypeScript type definitions for Gjs using [ts-for-gir](https://github.com/gjsify/ts-for-gir) v3.0.0-beta.15.
5
5
 
6
6
  ## Install
7
7
 
8
- To use this type definitions, install them with NPM like this:
8
+ To use this type definitions, install them with NPM:
9
9
  ```bash
10
10
  npm install @girs/gjs
11
11
  ```
@@ -22,13 +22,44 @@ Or if you prefer CommonJS, you can also use this:
22
22
  const Gjs = require('@girs/gjs');
23
23
  ```
24
24
 
25
- If you want to use [ambient modules](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules), you can import all ambient module types like this:
25
+ ### Ambient Modules
26
+
27
+ You can import core [ambient module](https://github.com/gjsify/ts-for-gir/tree/main/packages/cli#ambient-modules) types.
28
+ For this you need to include the `@girs/gjs` or `@girs/gjs/ambient` in your `tsconfig` or entry point Typescript file:
29
+
30
+ `index.ts`:
31
+ ```ts
32
+ import '@girs/gjs'
33
+ ```
34
+
35
+ `tsconfig.json`:
36
+ ```json
37
+ {
38
+ "compilerOptions": {
39
+ ...
40
+ },
41
+ "include": ["@girs/gjs"],
42
+ ...
43
+ }
44
+ ```
45
+
46
+
47
+ Now you can import `gettext` and `system` in ESM style with Typescript support:
48
+
26
49
  ```ts
27
- import '@girs/gjs/ambient'
50
+ import gettext from 'gettext';
51
+ import system from 'system';
28
52
  ```
29
53
 
54
+
55
+ 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](https://www.npmjs.com/package/@girs/gtk-4.0).
56
+
57
+
58
+ ### Bundle
59
+
30
60
  Depending on your project configuration, it is recommended to use a bundler like [esbuild](https://esbuild.github.io/). You can find examples using different bundlers [here](https://github.com/gjsify/ts-for-gir/tree/main/examples).
31
61
 
32
62
  ## Other packages
33
63
 
34
- All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
64
+ All existing pre-generated packages can be found on [gjsify/types](https://github.com/gjsify/types).
65
+