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: #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 ruyadorno committed Nov 27, 2024
1 parent 2b561ab commit 0e69f6d
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 0e69f6d

Please sign in to comment.