Skip to content

feat(learn): organise TypeScript articles from simplest to advanced usage #7465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions apps/site/navigation.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions apps/site/pages/en/learn/typescript/run-natively.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion apps/site/pages/en/learn/typescript/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 1 addition & 1 deletion apps/site/pages/en/learn/typescript/transpile.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading