doc: add suggested tsconfig for type stripping

PR-URL: https://github.com/nodejs/node/pull/55534
Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
Marco Ippolito 2024-10-27 08:52:50 -05:00 committed by RafaelGSS
parent bb78904548
commit f77bf65059
No known key found for this signature in database
GPG Key ID: 8BEAB4DFCF555EF4
1 changed files with 15 additions and 0 deletions

View File

@ -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