Skip to content

TypeScript section into JavaScript interop #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions data/sidebar_manual_latest.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,8 @@
"use-illegal-identifier-names",
"generate-converters-accessors",
"browser-support-polyfills",
"libraries"
],
"TypeScript Interop": [
"gentype-introduction",
"gentype-usage",
"bind-to-ts-primitive",
"bind-to-ts-collections",
"bind-to-ts-object",
"bind-to-ts-option-null",
"bind-to-ts-function",
"bind-to-ts-variant",
"bind-to-ts-other"
"libraries",
"typescript-integration"
],
"Build System": [
"build-overview",
Expand Down
20 changes: 0 additions & 20 deletions pages/docs/manual/latest/bind-to-ts-collections.mdx

This file was deleted.

24 changes: 0 additions & 24 deletions pages/docs/manual/latest/bind-to-ts-function.mdx

This file was deleted.

26 changes: 0 additions & 26 deletions pages/docs/manual/latest/bind-to-ts-object.mdx

This file was deleted.

18 changes: 0 additions & 18 deletions pages/docs/manual/latest/bind-to-ts-option-null.mdx

This file was deleted.

86 changes: 0 additions & 86 deletions pages/docs/manual/latest/bind-to-ts-other.mdx

This file was deleted.

19 changes: 0 additions & 19 deletions pages/docs/manual/latest/bind-to-ts-primitive.mdx

This file was deleted.

35 changes: 0 additions & 35 deletions pages/docs/manual/latest/bind-to-ts-variant.mdx

This file was deleted.

35 changes: 35 additions & 0 deletions pages/docs/manual/latest/build-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,41 @@ The warning numbers are shown in the build output when they're triggered. See [W

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

## gentypeconfig

To enable genType, set `"gentypeconfig"` at top level in the project's `rescript.json`.

```json
{
"gentypeconfig": {
"module": "es6",
"moduleResolution": "node",
"generatedFileExtension": ".gen.tsx",
"debug": {
"all": false,
"basic": false
}
}
}
```

`generatedFileExtension`: File extension used for genType generated files (defaults to `".gen.tsx"`)

`module`: Module format used for the generated `*.gen.tsx` files (supports `"es6"` and `"commonjs"`)

`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`.
- `"node"`(default): Drop extensions in import paths.
- `"node16"`: Use TS output's extension. This provides compatibility with projects using `"moduleResolution": "node16"` and ES Modules.
- `"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`

`debug`: Enable debug logs.

### Deprecated options

`language`: the `language` setting is not required from compiler v10.1.

`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.

## Environment Variables

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