Skip to content

Commit 8987159

Browse files
marco-ippolitotargos
authored andcommitted
module: mark type stripping as stable
PR-URL: #60600 Refs: nodejs/typescript#24 Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruy Adorno <ruy@vlt.sh> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent ff57540 commit 8987159

File tree

19 files changed

+64
-48
lines changed

19 files changed

+64
-48
lines changed

doc/api/cli.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ only recognizes double `"` for quoting. In Powershell or Git bash, both `'`
905905
and `"` are usable.
906906

907907
It is possible to run code containing inline types unless the
908-
[`--no-experimental-strip-types`][] flag is provided.
908+
[`--no-strip-types`][] flag is provided.
909909

910910
### `--experimental-addon-modules`
911911

@@ -1504,7 +1504,7 @@ changes:
15041504

15051505
This configures Node.js to interpret `--eval` or `STDIN` input as CommonJS or
15061506
as an ES module. Valid values are `"commonjs"`, `"module"`, `"module-typescript"` and `"commonjs-typescript"`.
1507-
The `"-typescript"` values are not available with the flag `--no-experimental-strip-types`.
1507+
The `"-typescript"` values are not available with the flag `--no-strip-types`.
15081508
The default is no value, or `"commonjs"` if `--no-experimental-detect-module` is passed.
15091509

15101510
If `--input-type` is not provided,
@@ -1821,21 +1821,6 @@ changes:
18211821

18221822
Disable the experimental [`node:sqlite`][] module.
18231823

1824-
### `--no-experimental-strip-types`
1825-
1826-
<!-- YAML
1827-
added: v22.6.0
1828-
changes:
1829-
- version: v23.6.0
1830-
pr-url: https://github.com/nodejs/node/pull/56350
1831-
description: Type stripping is enabled by default.
1832-
-->
1833-
1834-
> Stability: 1.2 - Release candidate
1835-
1836-
Disable experimental type-stripping for TypeScript files.
1837-
For more information, see the [TypeScript type-stripping][] documentation.
1838-
18391824
### `--no-experimental-websocket`
18401825

18411826
<!-- YAML
@@ -1885,6 +1870,24 @@ changes:
18851870
Disables the family autoselection algorithm unless connection options explicitly
18861871
enables it.
18871872

1873+
### `--no-strip-types`
1874+
1875+
<!-- YAML
1876+
added: v22.6.0
1877+
changes:
1878+
- version: REPLACEME
1879+
pr-url: https://github.com/nodejs/node/pull/60600
1880+
description: Type stripping is now stable.
1881+
- version:
1882+
- v23.6.0
1883+
- v22.18.0
1884+
pr-url: https://github.com/nodejs/node/pull/56350
1885+
description: Type stripping is enabled by default.
1886+
-->
1887+
1888+
Disable type-stripping for TypeScript files.
1889+
For more information, see the [TypeScript type-stripping][] documentation.
1890+
18881891
### `--no-warnings`
18891892

18901893
<!-- YAML
@@ -3451,6 +3454,7 @@ one is included in the list below.
34513454
* `--no-force-async-hooks-checks`
34523455
* `--no-global-search-paths`
34533456
* `--no-network-family-autoselection`
3457+
* `--no-strip-types`
34543458
* `--no-warnings`
34553459
* `--node-memory-debug`
34563460
* `--openssl-config`
@@ -4009,7 +4013,7 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
40094013
[`--experimental-webstorage`]: #--experimental-webstorage
40104014
[`--heap-prof-dir`]: #--heap-prof-dir
40114015
[`--import`]: #--importmodule
4012-
[`--no-experimental-strip-types`]: #--no-experimental-strip-types
4016+
[`--no-strip-types`]: #--no-strip-types
40134017
[`--openssl-config`]: #--openssl-configfile
40144018
[`--preserve-symlinks`]: #--preserve-symlinks
40154019
[`--print`]: #-p---print-script

doc/api/process.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2086,6 +2086,10 @@ This value is therefore identical to that of `process.features.tls`.
20862086
added:
20872087
- v23.0.0
20882088
- v22.10.0
2089+
changes:
2090+
- version: REPLACEME
2091+
pr-url: https://github.com/nodejs/node/pull/60600
2092+
description: Type stripping is now stable.
20892093
-->
20902094
20912095
> Stability: 1.2 - Release candidate
@@ -2094,7 +2098,7 @@ added:
20942098
20952099
A value that is `"strip"` by default,
20962100
`"transform"` if Node.js is run with `--experimental-transform-types`, and `false` if
2097-
Node.js is run with `--no-experimental-strip-types`.
2101+
Node.js is run with `--no-strip-types`.
20982102
20992103
## `process.features.uv`
21002104

doc/api/test.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ By default, Node.js will run all files matching these patterns:
514514
* `**/test.{cjs,mjs,js}`
515515
* `**/test/**/*.{cjs,mjs,js}`
516516

517-
Unless [`--no-experimental-strip-types`][] is supplied, the following
517+
Unless [`--no-strip-types`][] is supplied, the following
518518
additional patterns are also matched:
519519

520520
* `**/*.test.{cts,mts,ts}`
@@ -3991,7 +3991,7 @@ Can be used to abort test subtasks when the test has been aborted.
39913991
[`--experimental-test-coverage`]: cli.md#--experimental-test-coverage
39923992
[`--experimental-test-module-mocks`]: cli.md#--experimental-test-module-mocks
39933993
[`--import`]: cli.md#--importmodule
3994-
[`--no-experimental-strip-types`]: cli.md#--no-experimental-strip-types
3994+
[`--no-strip-types`]: cli.md#--no-strip-types
39953995
[`--test-concurrency`]: cli.md#--test-concurrency
39963996
[`--test-coverage-exclude`]: cli.md#--test-coverage-exclude
39973997
[`--test-coverage-include`]: cli.md#--test-coverage-include

doc/api/typescript.md

Lines changed: 10 additions & 3 deletions
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/60600
7+
description: Type stripping is now stable.
58
- version: v24.3.0
69
pr-url: https://github.com/nodejs/node/pull/58643
710
description: Type stripping no longer emits an experimental warning.
@@ -15,7 +18,7 @@ changes:
1518

1619
<!--introduced_in=v22.6.0-->
1720

18-
> Stability: 1.2 - Release candidate
21+
> Stability: 2 - Stable
1922
2023
## Enabling
2124

@@ -56,6 +59,10 @@ To use TypeScript with full support for all TypeScript features, including
5659

5760
<!-- YAML
5861
added: v22.6.0
62+
changes:
63+
- version: REPLACEME
64+
pr-url: https://github.com/nodejs/node/pull/60600
65+
description: Type stripping is now stable.
5966
-->
6067

6168
By default Node.js will execute TypeScript files that contains only
@@ -64,7 +71,7 @@ Node.js will replace TypeScript syntax with whitespace,
6471
and no type checking is performed.
6572
To enable the transformation of non erasable TypeScript syntax, which requires JavaScript code generation,
6673
such as `enum` declarations, parameter properties use the flag [`--experimental-transform-types`][].
67-
To disable this feature, use the flag [`--no-experimental-strip-types`][].
74+
To disable this feature, use the flag [`--no-strip-types`][].
6875

6976
Node.js ignores `tsconfig.json` files and therefore
7077
features that depend on settings within `tsconfig.json`,
@@ -215,7 +222,7 @@ with `#`.
215222
[ES Modules]: esm.md
216223
[Full TypeScript support]: #full-typescript-support
217224
[`--experimental-transform-types`]: cli.md#--experimental-transform-types
218-
[`--no-experimental-strip-types`]: cli.md#--no-experimental-strip-types
225+
[`--no-strip-types`]: cli.md#--no-strip-types
219226
[`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`]: errors.md#err_unsupported_typescript_syntax
220227
[`tsconfig` "paths"]: https://www.typescriptlang.org/tsconfig/#paths
221228
[`tsx`]: https://tsx.is/

doc/contributing/advocacy-ambassador-program.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ You can find their contact email in the [`README.md`](../../README.md#tsc-techni
226226

227227
##### Goal
228228

229-
The goal is to raise awareness of the Node.js TypeScript Type Stripping in the JavaScript ecosystem.
229+
The goal is to raise awareness of the Node.js TypeScript Type stripping in the JavaScript ecosystem.
230230
Some of the things to highlight include:
231231

232232
* The benefits and limitations of the current implementation.
@@ -271,7 +271,7 @@ with projects learning from one another and their users.
271271
| [reading environment](https://nodejs.org/api/cli.html#--env-filefile) | [20.6.0](https://nodejs.org/en/blog/release/v20.6.0) | Active Development |
272272
| [styling output](https://nodejs.org/docs/latest-v22.x/api/util.html#utilstyletextformat-text-options) | [20.12.0](https://nodejs.org/en/blog/release/v20.12.0) | Stable, as of [22.13.0](https://github.com/nodejs/node/pull/56329) |
273273
| [run scripts](https://nodejs.org/docs/latest/api/cli.html#--run) | [22.0.0](https://nodejs.org/en/blog/release/v22.0.0) | Stable, as of 22.0.0 |
274-
| [run TypeScript](https://nodejs.org/api/cli.html#--experimental-strip-types) | [22.6.0](https://nodejs.org/en/blog/release/v22.6.0) | Active Development |
274+
| [run TypeScript](https://nodejs.org/api/cli.html#--strip-types) | [22.6.0](https://nodejs.org/en/blog/release/v22.6.0) | Stable, as of REPLACEME |
275275

276276
##### Related Links
277277

@@ -284,7 +284,7 @@ with projects learning from one another and their users.
284284
* <https://nodejs.org/api/cli.html#--env-filefile>
285285
* <https://nodejs.org/docs/latest-v22.x/api/util.html#utilstyletextformat-text-options>
286286
* <https://nodejs.org/api/cli.html#--run>
287-
* <https://nodejs.org/api/cli.html#--experimental-strip-types>
287+
* <https://nodejs.org/api/cli.html#--strip-types>
288288

289289
<!-- lint enable prohibited-strings remark-lint-->
290290

doc/node-config-schema.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,6 @@
168168
"experimental-sqlite": {
169169
"type": "boolean"
170170
},
171-
"experimental-strip-types": {
172-
"type": "boolean"
173-
},
174171
"experimental-transform-types": {
175172
"type": "boolean"
176173
},
@@ -355,6 +352,9 @@
355352
"stack-trace-limit": {
356353
"type": "number"
357354
},
355+
"strip-types": {
356+
"type": "boolean"
357+
},
358358
"test-coverage-branches": {
359359
"type": "number"
360360
},

doc/node.1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ Disable top-level await keyword support in REPL.
210210
.It Fl -no-experimental-sqlite
211211
Disable the experimental node:sqlite module.
212212
.
213-
.It Fl -no-experimental-strip-types
214-
Disable experimental type-stripping for TypeScript files.
213+
.It Fl -no-strip-types
214+
Disable type-stripping for TypeScript files.
215215
.
216216
.It Fl -experimental-vm-modules
217217
Enable experimental ES module support in VM module.

lib/internal/bootstrap/node.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ ObjectDefineProperty(process.features, 'typescript', {
327327
if (kTypeStrippingMode === null) {
328328
if (getOptionValue('--experimental-transform-types')) {
329329
kTypeStrippingMode = 'transform';
330-
} else if (getOptionValue('--experimental-strip-types')) {
330+
} else if (getOptionValue('--strip-types')) {
331331
kTypeStrippingMode = 'strip';
332332
} else {
333333
kTypeStrippingMode = false;

lib/internal/main/eval_stdin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ readStdin((code) => {
2929
const print = getOptionValue('--print');
3030
const shouldLoadESM = getOptionValue('--import').length > 0;
3131
const inputType = getOptionValue('--input-type');
32-
const tsEnabled = getOptionValue('--experimental-strip-types');
32+
const tsEnabled = getOptionValue('--strip-types');
3333
if (inputType === 'module') {
3434
evalModuleEntryPoint(code, print);
3535
} else if (inputType === 'module-typescript' && tsEnabled) {

lib/internal/main/eval_string.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const code = getOptionValue('--eval');
3232
const print = getOptionValue('--print');
3333
const shouldLoadESM = getOptionValue('--import').length > 0 || getOptionValue('--experimental-loader').length > 0;
3434
const inputType = getOptionValue('--input-type');
35-
const tsEnabled = getOptionValue('--experimental-strip-types');
35+
const tsEnabled = getOptionValue('--strip-types');
3636
if (inputType === 'module') {
3737
evalModuleEntryPoint(code, print);
3838
} else if (inputType === 'module-typescript' && tsEnabled) {

0 commit comments

Comments
 (0)