Skip to content

Commit b6bcd40

Browse files
update
1 parent 9e74f30 commit b6bcd40

File tree

2 files changed

+6
-28
lines changed

2 files changed

+6
-28
lines changed

apps/site/pages/en/learn/typescript/run-natively.md

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,18 @@ layout: learn
44
authors: AugustinMauroy
55
---
66

7-
> **⚠️WARNING:** All content in this article uses Node.js experimental features. Please make sure you are using a version of Node.js that supports the features mentioned in this article. And remember that experimental features can change on future versions of Node.js.
7+
> **⚠️WARNING⚠️:** All content in this article uses Node.js experimental features. Please make sure you are using a version of Node.js that supports the features mentioned in this article. And remember that experimental features can change on future versions of Node.js.
88
99
# Running TypeScript with a Node.js Itself
1010

1111
In the previous articles, we learned how to run TypeScript code using transpilation and with a runner. In this article, we will learn how to run TypeScript code using Node.js itself.
1212

1313
## Running TypeScript code with Node.js
1414

15-
Node.js has experimental support for some TypeScript syntax. You can write code that's valid TypeScript directly in Node.js without the need to transpile it first.
15+
Since V22.6.0, Node.js has experimental support for some TypeScript syntax. You can write code that's valid TypeScript directly in Node.js without the need to transpile it first.
1616

1717
So how do you run typed JavaScript code with Node.js?
1818

19-
First, you need to install a nightly version of Node.js. You can download it from the [official Node.js website](https://nodejs.org/download/nightly/).
20-
21-
Then, you can run your file like this:
22-
2319
```bash
2420
node --experimental-strip-types example.ts
2521
```
@@ -33,28 +29,10 @@ In the future we all hope that this feature will be stable and available in the
3329

3430
At the time of writing, the experimental support for TypeScript in Node.js has some limitations. To allow typescript to run in node.js, our collaborators have chosen to only strip types from the code.
3531

36-
<!--
37-
Maintainers note: this content is copy from docs (unreleased) and should be updated when the docs are released with a link to the official documentation
38-
-->
39-
40-
Since Node.js is only removing inline types, any TypeScript features that
41-
involve _replacing_ TypeScript syntax with new JavaScript syntax will error.
42-
This is by design. To run TypeScript with such features, see
43-
[Full TypeScript support][].
44-
45-
The most prominent unsupported features that require transformation are:
46-
47-
- `Enum`
48-
- `experimentalDecorators`
49-
- `namespaces`
50-
- parameter properties
51-
52-
In addition, Node.js does not read `tsconfig.json` files and does not support
53-
features that depend on settings within `tsconfig.json`, such as paths or
54-
converting newer JavaScript syntax into older standards.
32+
You can get more information on the [api docs](https://nodejs.org/docs/latest/api/typescript.html#unsupported-typescript-features)
5533

5634
## Important notes
5735

5836
Thanks to all the contributors who have made this feature possible. We hope that this feature will be stable and available in the LTS version of Node.js soon.
5937

60-
We can understand that this feature is experimental and has some limitations; if that doesn't suit your usecase, please use something else, or contribute a fix. Bug reports are also welcome, please keep in mind the project is run by volunteers, without warranty of any kind, so please be patient if you can't contribute the fix yourself.
38+
We can understand that this feature is experimental and has some limitations; if that doesn't suit your use-case, please use something else, or contribute a fix. Bug reports are also welcome, please keep in mind the project is run by volunteers, without warranty of any kind, so please be patient if you can't contribute the fix yourself.

apps/site/site.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
},
3838
"websiteBadges": {
3939
"index": {
40-
"startDate": "2024-07-01T00:00:00.000Z",
41-
"endDate": "2024-08-01T00:00:00.000Z",
40+
"startDate": "2024-08-01T00:00:00.000Z",
41+
"endDate": "2024-09-01T00:00:00.000Z",
4242
"kind": "default",
4343
"title": "Discover",
4444
"text": "TypeScript in Node.js",

0 commit comments

Comments
 (0)