@@ -56,7 +56,7 @@ added: v22.6.0
56
56
57
57
The flag [ ` --experimental-strip-types ` ] [ ] enables Node.js to run TypeScript
58
58
files. By default Node.js will execute only files that contain no
59
- TypeScript features that require transformation, such as enums or namespaces .
59
+ TypeScript features that require transformation, such as enums.
60
60
Node.js will replace inline type annotations with whitespace,
61
61
and no type checking is performed.
62
62
To enable the transformation of such features
@@ -123,10 +123,30 @@ unless the flag [`--experimental-transform-types`][] is passed.
123
123
124
124
The most prominent features that require transformation are:
125
125
126
- * ` Enum `
127
- * ` namespaces `
128
- * ` legacy module `
126
+ * ` Enum ` declarations
127
+ * ` namespace ` with runtime code
128
+ * legacy ` module ` with runtime code
129
129
* parameter properties
130
+ * import aliases
131
+
132
+ ` namespaces ` and ` module ` that do not contain runtime code are supported.
133
+ This example will work correctly:
134
+
135
+ ``` ts
136
+ // This namespace is exporting a type
137
+ namespace TypeOnly {
138
+ export type A = string ;
139
+ }
140
+ ```
141
+
142
+ This will result in [ ` ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX ` ] [ ] error:
143
+
144
+ ``` ts
145
+ // This namespace is exporting a value
146
+ namespace A {
147
+ export let x = 1
148
+ }
149
+ ```
130
150
131
151
Since Decorators are currently a [ TC39 Stage 3 proposal] ( https://github.com/tc39/proposal-decorators )
132
152
and will soon be supported by the JavaScript engine,
@@ -188,6 +208,7 @@ with `#`.
188
208
[ CommonJS ] : modules.md
189
209
[ ES Modules ] : esm.md
190
210
[ Full TypeScript support ] : #full-typescript-support
211
+ [ `ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX` ] : errors.md#err_unsupported_typescript_syntax
191
212
[ `--experimental-strip-types` ] : cli.md#--experimental-strip-types
192
213
[ `--experimental-transform-types` ] : cli.md#--experimental-transform-types
193
214
[ `tsconfig` "paths" ] : https://www.typescriptlang.org/tsconfig/#paths
0 commit comments