Skip to content

Commit

Permalink
Merge pull request #1 from cometkim/gentype-to-main-docs
Browse files Browse the repository at this point in the history
TypeScript section into JavaScript interop
  • Loading branch information
fhammerschmidt authored Dec 27, 2023
2 parents 9889c7d + e9a89fa commit 5283161
Show file tree
Hide file tree
Showing 12 changed files with 233 additions and 610 deletions.
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

0 comments on commit 5283161

Please sign in to comment.