Skip to content

Commit c4a6105

Browse files
TypeScript section into JavaScript interop
Co-authored-by: Florian Hammerschmidt <[email protected]>
1 parent 339f77a commit c4a6105

12 files changed

+233
-610
lines changed

data/sidebar_manual_latest.json

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,8 @@
5151
"use-illegal-identifier-names",
5252
"generate-converters-accessors",
5353
"browser-support-polyfills",
54-
"libraries"
55-
],
56-
"TypeScript Interop": [
57-
"gentype-introduction",
58-
"gentype-usage",
59-
"bind-to-ts-primitive",
60-
"bind-to-ts-collections",
61-
"bind-to-ts-object",
62-
"bind-to-ts-option-null",
63-
"bind-to-ts-function",
64-
"bind-to-ts-variant",
65-
"bind-to-ts-other"
54+
"libraries",
55+
"typescript-integration"
6656
],
6757
"Build System": [
6858
"build-overview",

pages/docs/manual/latest/bind-to-ts-collections.mdx

Lines changed: 0 additions & 20 deletions
This file was deleted.

pages/docs/manual/latest/bind-to-ts-function.mdx

Lines changed: 0 additions & 24 deletions
This file was deleted.

pages/docs/manual/latest/bind-to-ts-object.mdx

Lines changed: 0 additions & 26 deletions
This file was deleted.

pages/docs/manual/latest/bind-to-ts-option-null.mdx

Lines changed: 0 additions & 18 deletions
This file was deleted.

pages/docs/manual/latest/bind-to-ts-other.mdx

Lines changed: 0 additions & 86 deletions
This file was deleted.

pages/docs/manual/latest/bind-to-ts-primitive.mdx

Lines changed: 0 additions & 19 deletions
This file was deleted.

pages/docs/manual/latest/bind-to-ts-variant.mdx

Lines changed: 0 additions & 35 deletions
This file was deleted.

pages/docs/manual/latest/build-configuration.mdx

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,41 @@ The warning numbers are shown in the build output when they're triggered. See [W
192192

193193
Extra flags to pass to the compiler. For advanced usages.
194194

195+
## gentypeconfig
196+
197+
To enable genType, set `"gentypeconfig"` at top level in the project's `rescript.json`.
198+
199+
```json
200+
{
201+
"gentypeconfig": {
202+
"module": "es6",
203+
"moduleResolution": "node",
204+
"generatedFileExtension": ".gen.tsx",
205+
"debug": {
206+
"all": false,
207+
"basic": false
208+
}
209+
}
210+
}
211+
```
212+
213+
`generatedFileExtension`: File extension used for genType generated files (defaults to `".gen.tsx"`)
214+
215+
`module`: Module format used for the generated `*.gen.tsx` files (supports `"es6"` and `"commonjs"`)
216+
217+
`moduleResolution`: Module resolution strategy used in genType outputs. This may be required for compatibility with TypeScript projects. Specify the value as the same in `tsconfig.json`.
218+
- `"node"`(default): Drop extensions in import paths.
219+
- `"node16"`: Use TS output's extension. This provides compatibility with projects using `"moduleResolution": "node16"` and ES Modules.
220+
- `"bundler"`: Use TS input's extension. This provides compatibility with projects using `"moduleResolution": "bundler"` and ES Modules. This also requires TS v5.0+ and `compilerOptions.allowImportingTsExtensions` to `true`
221+
222+
`debug`: Enable debug logs.
223+
224+
### Deprecated options
225+
226+
`language`: the `language` setting is not required from compiler v10.1.
227+
228+
`shims`: Required only if one needs to export certain basic ReScript data types to JS when one cannot modify the sources to add annotations (e.g. exporting ReScript lists), and if the types are not first-classed in genType.
229+
195230
## Environment Variables
196231

197232
We heavily disrecommend the usage of environment variables, but for certain cases, they're justified.

0 commit comments

Comments
 (0)