Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 89f4b6c

Browse filesBrowse files
module: remove --experimental-transform-types
PR-URL: #61803 Refs: nodejs/typescript#51 Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Zeyu "Alex" Yang <himself65@outlook.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Pietro Marchini <pietro.marchini94@gmail.com>
1 parent db27883 commit 89f4b6c
Copy full SHA for 89f4b6c

48 files changed

+50-872Lines changed: 50 additions & 872 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎benchmark/fixtures/transform-types-benchmark.js‎

Copy file name to clipboardExpand all lines: benchmark/fixtures/transform-types-benchmark.js
-28Lines changed: 0 additions & 28 deletions
This file was deleted.
Collapse file

‎benchmark/fixtures/transform-types-benchmark.ts‎

Copy file name to clipboardExpand all lines: benchmark/fixtures/transform-types-benchmark.ts
-30Lines changed: 0 additions & 30 deletions
This file was deleted.
Collapse file

‎benchmark/ts/transform-typescript.js‎

Copy file name to clipboardExpand all lines: benchmark/ts/transform-typescript.js
-26Lines changed: 0 additions & 26 deletions
This file was deleted.
Collapse file

‎doc/api/cli.md‎

Copy file name to clipboardExpand all lines: doc/api/cli.md
-12Lines changed: 0 additions & 12 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1315,17 +1315,6 @@ Enable module mocking in the test runner.
13151315

13161316
This feature requires `--allow-worker` if used with the [Permission Model][].
13171317

1318-
### `--experimental-transform-types`
1319-
1320-
<!-- YAML
1321-
added: v22.7.0
1322-
-->
1323-
1324-
> Stability: 1.2 - Release candidate
1325-
1326-
Enables the transformation of TypeScript-only syntax into JavaScript code.
1327-
Implies `--enable-source-maps`.
1328-
13291318
### `--experimental-vm-modules`
13301319

13311320
<!-- YAML
@@ -3621,7 +3610,6 @@ one is included in the list below.
36213610
* `--experimental-specifier-resolution`
36223611
* `--experimental-test-isolation`
36233612
* `--experimental-top-level-await`
3624-
* `--experimental-transform-types`
36253613
* `--experimental-vm-modules`
36263614
* `--experimental-wasi-unstable-preview1`
36273615
* `--force-context-aware`
Collapse file

‎doc/api/module.md‎

Copy file name to clipboardExpand all lines: doc/api/module.md
+4-42Lines changed: 4 additions & 42 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ See [Customization hooks][].
245245
added:
246246
- v23.2.0
247247
- v22.13.0
248+
changes:
249+
- version: REPLACEME
250+
pr-url: https://github.com/nodejs/node/pull/61803
251+
description: Removed `transform` and `sourceMap` options.
248252
-->
249253
250254
> Stability: 1.2 - Release candidate
@@ -253,9 +257,6 @@ added:
253257
* `options` {Object}
254258
* `mode` {string} **Default:** `'strip'`. Possible values are:
255259
* `'strip'` Only strip type annotations without performing the transformation of TypeScript features.
256-
* `'transform'` Strip type annotations and transform TypeScript features to JavaScript.
257-
* `sourceMap` {boolean} **Default:** `false`. Only when `mode` is `'transform'`, if `true`, a source map
258-
will be generated for the transformed code.
259260
* `sourceUrl` {string} Specifies the source url used in the source map.
260261
* Returns: {string} The code with type annotations stripped.
261262
`module.stripTypeScriptTypes()` removes type annotations from TypeScript code. It
@@ -264,10 +265,6 @@ added:
264265
By default, it will throw an error if the code contains TypeScript features
265266
that require transformation such as `Enums`,
266267
see [type-stripping][] for more information.
267-
When mode is `'transform'`, it also transforms TypeScript features to JavaScript,
268-
see [transform TypeScript features][] for more information.
269-
When mode is `'strip'`, source maps are not generated, because locations are preserved.
270-
If `sourceMap` is provided, when mode is `'strip'`, an error will be thrown.
271268
272269
_WARNING_: The output of this function should not be considered stable across Node.js versions,
273270
due to changes in the TypeScript parser.
@@ -306,40 +303,6 @@ console.log(strippedCode);
306303
// Prints: const a = 1\n\n//# sourceURL=source.ts;
307304
```
308305
309-
When `mode` is `'transform'`, the code is transformed to JavaScript:
310-
311-
```mjs
312-
import { stripTypeScriptTypes } from 'node:module';
313-
const code = `
314-
namespace MathUtil {
315-
export const add = (a: number, b: number) => a + b;
316-
}`;
317-
const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
318-
console.log(strippedCode);
319-
// Prints:
320-
// var MathUtil;
321-
// (function(MathUtil) {
322-
// MathUtil.add = (a, b)=>a + b;
323-
// })(MathUtil || (MathUtil = {}));
324-
// # sourceMappingURL=data:application/json;base64, ...
325-
```
326-
327-
```cjs
328-
const { stripTypeScriptTypes } = require('node:module');
329-
const code = `
330-
namespace MathUtil {
331-
export const add = (a: number, b: number) => a + b;
332-
}`;
333-
const strippedCode = stripTypeScriptTypes(code, { mode: 'transform', sourceMap: true });
334-
console.log(strippedCode);
335-
// Prints:
336-
// var MathUtil;
337-
// (function(MathUtil) {
338-
// MathUtil.add = (a, b)=>a + b;
339-
// })(MathUtil || (MathUtil = {}));
340-
// # sourceMappingURL=data:application/json;base64, ...
341-
```
342-
343306
### `module.syncBuiltinESMExports()`
344307
345308
<!-- YAML
@@ -2041,5 +2004,4 @@ returned object contains the following keys:
20412004
[synchronous hook functions]: #hook-functions-accepted-by-moduleregisterhooks
20422005
[the documentation of `Worker`]: worker_threads.md#new-workerfilename-options
20432006
[transferable objects]: worker_threads.md#portpostmessagevalue-transferlist
2044-
[transform TypeScript features]: typescript.md#typescript-features
20452007
[type-stripping]: typescript.md#type-stripping
Collapse file

‎doc/api/process.md‎

Copy file name to clipboardExpand all lines: doc/api/process.md
+4-2Lines changed: 4 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2002,6 +2002,9 @@ added:
20022002
- v23.0.0
20032003
- v22.10.0
20042004
changes:
2005+
- version: REPLACEME
2006+
pr-url: https://github.com/nodejs/node/pull/61803
2007+
description: Removed `transform` value.
20052008
- version:
20062009
- v25.2.0
20072010
- v24.12.0
@@ -2013,8 +2016,7 @@ changes:
20132016
20142017
* Type: {boolean|string}
20152018
2016-
A value that is `"strip"` by default,
2017-
`"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
2019+
A value that is `"strip"` by default, and `false` if
20182020
Node.js is run with `--no-strip-types`.
20192021
20202022
## `process.features.uv`
Collapse file

‎doc/api/typescript.md‎

Copy file name to clipboardExpand all lines: doc/api/typescript.md
+4-7Lines changed: 4 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
<!-- YAML
44
changes:
5+
- version: REPLACEME
6+
pr-url: https://github.com/nodejs/node/pull/61803
7+
description: Removed `--experimental-transform-types` flag.
58
- version:
69
- v25.2.0
710
- v24.12.0
@@ -77,8 +80,6 @@ By default Node.js will execute TypeScript files that contains only
7780
erasable TypeScript syntax.
7881
Node.js will replace TypeScript syntax with whitespace,
7982
and no type checking is performed.
80-
To enable the transformation of non erasable TypeScript syntax, which requires JavaScript code generation,
81-
such as `enum` declarations, parameter properties use the flag [`--experimental-transform-types`][].
8283
To disable this feature, use the flag [`--no-strip-types`][].
8384

8485
Node.js ignores `tsconfig.json` files and therefore
@@ -139,8 +140,7 @@ include the `.ts` extension.
139140
### TypeScript features
140141

141142
Since Node.js is only removing inline types, any TypeScript features that
142-
involve _replacing_ TypeScript syntax with new JavaScript syntax will error,
143-
unless the flag [`--experimental-transform-types`][] is passed.
143+
involve _replacing_ TypeScript syntax with new JavaScript syntax will error.
144144

145145
The most prominent features that require transformation are:
146146

@@ -210,8 +210,6 @@ TypeScript syntax is unsupported in the REPL, `--check`, and
210210

211211
Since inline types are replaced by whitespace, source maps are unnecessary for
212212
correct line numbers in stack traces; and Node.js does not generate them.
213-
When [`--experimental-transform-types`][] is enabled, source-maps
214-
are enabled by default.
215213

216214
### Type stripping in dependencies
217215

@@ -228,7 +226,6 @@ with `#`.
228226
[CommonJS]: modules.md
229227
[ES Modules]: esm.md
230228
[Full TypeScript support]: #full-typescript-support
231-
[`--experimental-transform-types`]: cli.md#--experimental-transform-types
232229
[`--no-strip-types`]: cli.md#--no-strip-types
233230
[`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`]: errors.md#err_unsupported_typescript_syntax
234231
[`tsconfig` "paths"]: https://www.typescriptlang.org/tsconfig/#paths
Collapse file

‎doc/api/util.md‎

Copy file name to clipboardExpand all lines: doc/api/util.md
+1-2Lines changed: 1 addition & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -679,8 +679,7 @@ anotherFunction();
679679

680680
It is possible to reconstruct the original locations by setting the option `sourceMap` to `true`.
681681
If the source map is not available, the original location will be the same as the current location.
682-
When the `--enable-source-maps` flag is enabled, for example when using `--experimental-transform-types`,
683-
`sourceMap` will be true by default.
682+
When the `--enable-source-maps` flag is enabled,`sourceMap` will be true by default.
684683

685684
```ts
686685
import { getCallSites } from 'node:util';
Collapse file

‎doc/node-config-schema.json‎

Copy file name to clipboardExpand all lines: doc/node-config-schema.json
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,10 +213,6 @@
213213
"type": "boolean",
214214
"description": "experimental node:sqlite module"
215215
},
216-
"experimental-transform-types": {
217-
"type": "boolean",
218-
"description": "enable transformation of TypeScript-onlysyntax into JavaScript code"
219-
},
220216
"experimental-vm-modules": {
221217
"type": "boolean",
222218
"description": "experimental ES Module support in vm module"
Collapse file

‎doc/node.1‎

Copy file name to clipboardExpand all lines: doc/node.1
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,6 @@ collecting code coverage from tests for more details.
741741
Enable module mocking in the test runner.
742742
This feature requires \fB--allow-worker\fR if used with the Permission Model.
743743
.
744-
.It Fl -experimental-transform-types
745-
Enables the transformation of TypeScript-only syntax into JavaScript code.
746-
Implies \fB--enable-source-maps\fR.
747-
.
748744
.It Fl -experimental-vm-modules
749745
Enable experimental ES Module support in the \fBnode:vm\fR module.
750746
.
@@ -1883,8 +1879,6 @@ one is included in the list below.
18831879
.It
18841880
\fB--experimental-top-level-await\fR
18851881
.It
1886-
\fB--experimental-transform-types\fR
1887-
.It
18881882
\fB--experimental-vm-modules\fR
18891883
.It
18901884
\fB--experimental-wasi-unstable-preview1\fR

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.