Skip to content

Commit

Permalink
doc: add suggested tsconfig for type stripping
Browse files Browse the repository at this point in the history
PR-URL: nodejs#55534
Reviewed-By: Zeyu "Alex" Yang <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
  • Loading branch information
marco-ippolito authored and louwers committed Nov 2, 2024
1 parent cb20aa5 commit ee3fac4
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/api/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,21 @@ By intentionally not supporting syntaxes that require JavaScript code
generation, and by replacing inline types with whitespace, Node.js can run
TypeScript code without the need for source maps.

Type stripping works with most versions of TypeScript
but we recommend version 5.7 or newer with the following `tsconfig.json` settings:

```json
{
"compilerOptions": {
"target": "esnext",
"module": "nodenext",
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"verbatimModuleSyntax": true
}
}
```

### Determining module system

Node.js supports both [CommonJS][] and [ES Modules][] syntax in TypeScript
Expand Down

0 comments on commit ee3fac4

Please sign in to comment.