@@ -57,7 +57,7 @@ added: v22.6.0
5757
5858The flag [`--no-experimental-strip-types`][] prevents Node.js from running TypeScript
5959files. By default Node.js will execute only files that contain no
60- TypeScript features that require transformation, such as enums or namespaces .
60+ TypeScript features that require transformation, such as enums.
6161Node.js will replace inline type annotations with whitespace,
6262and no type checking is performed.
6363To enable the transformation of such features
@@ -119,10 +119,30 @@ unless the flag [`--experimental-transform-types`][] is passed.
119119
120120The most prominent features that require transformation are:
121121
122- * `Enum`
123- * `namespaces`
124- * ` legacy module`
122+ * `Enum` declarations
123+ * `namespace` with runtime code
124+ * legacy ` module` with runtime code
125125* parameter properties
126+ * import aliases
127+
128+ `namespaces` and `module` that do not contain runtime code are supported.
129+ This example will work correctly:
130+
131+ ```ts
132+ // This namespace is exporting a type
133+ namespace TypeOnly {
134+ export type A = string;
135+ }
136+ ```
137+
138+ This will result in [`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`][] error:
139+
140+ ```ts
141+ // This namespace is exporting a value
142+ namespace A {
143+ export let x = 1
144+ }
145+ ```
126146
127147Since Decorators are currently a [TC39 Stage 3 proposal](https://github.com/tc39/proposal-decorators)
128148and will soon be supported by the JavaScript engine,
@@ -184,6 +204,7 @@ with `#`.
184204[CommonJS]: modules.md
185205[ES Modules]: esm.md
186206[Full TypeScript support]: #full-typescript-support
207+ [`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`]: errors.md#err_unsupported_typescript_syntax
187208[`--experimental-transform-types`]: cli.md#--experimental-transform-types
188209[`--no-experimental-strip-types`]: cli.md#--no-experimental-strip-types
189210[`tsconfig` "paths"]: https://www.typescriptlang.org/tsconfig/#paths
0 commit comments