@@ -55,14 +55,16 @@ added: v22.6.0
55
55
56
56
> Stability: 1.1 - Active development
57
57
58
- The flag [ ` --no-experimental-strip-types ` ] [ ] prevents Node.js from running TypeScript
59
- files. By default Node.js will execute only files that contain no
60
- TypeScript features that require transformation, such as enums.
61
- Node.js will replace inline type annotations with whitespace,
58
+ By default Node.js will execute TypeScript files that contains only
59
+ erasable TypeScript syntax.
60
+ Node.js will replace TypeScript syntax with whitespace,
62
61
and no type checking is performed.
63
- To enable the transformation of such features
64
- use the flag [ ` --experimental-transform-types ` ] [ ] .
65
- TypeScript features that depend on settings within ` tsconfig.json ` ,
62
+ To enable the transformation of non erasable TypeScript syntax, which requires JavaScript code generation,
63
+ such as ` enum ` declarations, parameter properties use the flag [ ` --experimental-transform-types ` ] [ ] .
64
+ To disable this feature, use the flag [ ` --no-experimental-strip-types ` ] [ ] .
65
+
66
+ Node.js ignores ` tsconfig.json ` files and therefore
67
+ features that depend on settings within ` tsconfig.json ` ,
66
68
such as paths or converting newer JavaScript syntax to older standards, are
67
69
intentionally unsupported. To get full TypeScript support, see [ Full TypeScript support] [ ] .
68
70
@@ -71,7 +73,7 @@ By intentionally not supporting syntaxes that require JavaScript code
71
73
generation, and by replacing inline types with whitespace, Node.js can run
72
74
TypeScript code without the need for source maps.
73
75
74
- Type stripping works with most versions of TypeScript
76
+ Type stripping is compatible with most versions of TypeScript
75
77
but we recommend version 5.7 or newer with the following ` tsconfig.json ` settings:
76
78
77
79
``` json
@@ -139,7 +141,7 @@ This will result in [`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`][] error:
139
141
140
142
``` ts
141
143
// This namespace is exporting a value
142
- namespace A {
144
+ namespace A {
143
145
export let x = 1
144
146
}
145
147
```
@@ -204,9 +206,9 @@ with `#`.
204
206
[ CommonJS ] : modules.md
205
207
[ ES Modules ] : esm.md
206
208
[ Full TypeScript support ] : #full-typescript-support
207
- [ `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX` ] : errors.md#err_unsupported_typescript_syntax
208
209
[ `--experimental-transform-types` ] : cli.md#--experimental-transform-types
209
210
[ `--no-experimental-strip-types` ] : cli.md#--no-experimental-strip-types
211
+ [ `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX` ] : errors.md#err_unsupported_typescript_syntax
210
212
[ `tsconfig` "paths" ] : https://www.typescriptlang.org/tsconfig/#paths
211
213
[ `tsx` ] : https://tsx.is/
212
214
[ `verbatimModuleSyntax` ] : https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax
0 commit comments