diff --git a/apps/site/navigation.json b/apps/site/navigation.json index 87faeab6e3cfa..a764220103b07 100644 --- a/apps/site/navigation.json +++ b/apps/site/navigation.json @@ -211,17 +211,17 @@ "link": "/learn/typescript/introduction", "label": "components.navigation.learn.typescript.links.introduction" }, - "transpile": { - "link": "/learn/typescript/transpile", - "label": "components.navigation.learn.typescript.links.transpile" + "runNatively": { + "link": "/learn/typescript/run-natively", + "label": "components.navigation.learn.typescript.links.runNatively" }, "run": { "link": "/learn/typescript/run", "label": "components.navigation.learn.typescript.links.run" }, - "runNatively": { - "link": "/learn/typescript/run-natively", - "label": "components.navigation.learn.typescript.links.runNatively" + "transpile": { + "link": "/learn/typescript/transpile", + "label": "components.navigation.learn.typescript.links.transpile" }, "publishingTSPackage": { "link": "/learn/typescript/publishing-a-ts-package", diff --git a/apps/site/pages/en/learn/typescript/run-natively.md b/apps/site/pages/en/learn/typescript/run-natively.md index 773f0201077d0..f1da8de175753 100644 --- a/apps/site/pages/en/learn/typescript/run-natively.md +++ b/apps/site/pages/en/learn/typescript/run-natively.md @@ -4,11 +4,9 @@ layout: learn authors: AugustinMauroy, khaosdoctor, jakebailey, robpalme --- -> **⚠️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 in future versions of Node.js. - # Running TypeScript Natively -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. +Since v23.6.0, Node.js enables "type stripping" by default. If you are using v23.6.0 or later and your source code contains only [erasable typescript syntax](https://devblogs.microsoft.com/typescript/announcing-typescript-5-8-beta/#the---erasablesyntaxonly-option), you do not need this article. ## Running TypeScript code with Node.js @@ -28,7 +26,7 @@ In V22.7.0 this experimental support was extended to transform TypeScript-only s node --experimental-transform-types another-example.ts ``` -From V23 onwards, the `--experimental-strip-types` flag is enabled by default (you can disable it via the [`--no-experimental-strip-types`](https://nodejs.org/docs/latest-v23.x/api/cli.html#--no-experimental-strip-types) flag), enabling you to run any supported syntax, so running files like the one below with `node file.ts` is supported: +From v23.6.0 onwards, type stripping is enabled by default (you can disable it via [`--no-experimental-strip-types`](https://nodejs.org/docs/latest-v23.x/api/cli.html#--no-experimental-strip-types)), enabling you to run any supported syntax, so running files like the one below with `node file.ts` is supported: ```ts function foo(bar: number): string { diff --git a/apps/site/pages/en/learn/typescript/run.md b/apps/site/pages/en/learn/typescript/run.md index 15e7869ae6ef2..bf74775fbae5e 100644 --- a/apps/site/pages/en/learn/typescript/run.md +++ b/apps/site/pages/en/learn/typescript/run.md @@ -6,7 +6,7 @@ authors: AugustinMauroy # Running TypeScript with a runner -In the previous article, we learned how to run TypeScript code using transpilation. In this article, we will learn how to run TypeScript code using a runner. +If you want more advanced processing of TypeScript than the built-in support (or you're using Node.js prior to v22.7.0), you have 2 options: use a runner (which handles much of the complexity for you), or handle it all yourself via [transpilation](./transpile.md). ## Running TypeScript code with `ts-node` diff --git a/apps/site/pages/en/learn/typescript/transpile.md b/apps/site/pages/en/learn/typescript/transpile.md index 4f39ac23412eb..0d97d01e0cad2 100644 --- a/apps/site/pages/en/learn/typescript/transpile.md +++ b/apps/site/pages/en/learn/typescript/transpile.md @@ -6,7 +6,7 @@ authors: AugustinMauroy # Running TypeScript code using transpilation -Transpilation is the process of converting source code from one language to another. In the case of TypeScript, it's the process of converting TypeScript code to JavaScript code. This is necessary because browsers and Node.js can't run TypeScript code directly. +Transpilation is the process of converting source code from one language to another. In the case of TypeScript, it's the process of converting TypeScript code to JavaScript code. This is necessary because browsers and Node.js don't run TypeScript code directly. ## Compiling TypeScript to JavaScript