Skip to content

Commit 43f5c59

Browse files
Update from feedback
Co-Authored-By: Brian Muenzenmeyer <[email protected]>
1 parent 461bbd5 commit 43f5c59

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

apps/site/pages/en/learn/typescript/introduction.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ authors: sbielenica, ovflowd, vaishnav-mk, AugustinMauroy
88

99
## What is TypeScript
1010

11-
**[TypeScript](https://www.typescriptlang.org)** is an open-source language maintained and developed by Microsoft. It's loved and used by a lot of software developers around the world.
11+
**[TypeScript](https://www.typescriptlang.org)** is an open-source language maintained and developed by Microsoft.
1212

13-
Basically, TypeScript add adds additional syntax to JavaScript to support a tighter integration with your editor. Catch errors early in your editor or in your CI/CD pipeline, and write more maintainable code.
13+
Basically, TypeScript adds additional syntax to JavaScript to support a tighter integration with your editor. Catch errors early in your editor or in your CI/CD pipeline, and write more maintainable code.
1414

1515
We can talk about other TypeScript benefits later, let's see some examples now!
1616

@@ -42,7 +42,7 @@ const isJustineAnAdult = isAdult(justine);
4242

4343
The first part (with the `type` keyword) is responsible for declaring our custom object type representing users. Later we utilize this newly created type to create function `isAdult` that accepts one argument of type `User` and returns `boolean`. After this, we create `justine`, our example data that can be used for calling the previously defined function. Finally, we create a new variable with information on whether `justine` is an adult.
4444

45-
There are additional things about this example that you should know. Firstly, if we would not comply with declared types, TypeScript would alarm us that something is wrong and prevent misuse. Secondly, not everything must be typed explicitly - TypeScript is very smart and can infer types for us. For example, variable `isJustineAnAdult` is of type `boolean` even if we didn't type it explicitly or `justine` would be valid argument for our function even though we didn't declare this variable as of `User` type.
45+
There are additional things about this example that you should know. Firstly, if we do not comply with the declared types, TypeScript will inform us that something is wrong and prevent misuse. Secondly, not everything must be typed explicitlyTypeScript infers types for us. For example, the variable `isJustineAnAdult` is of type `boolean` even if we didn't type it explicitly, and `justine` would be a valid argument for our function even though we didn't declare this variable as of `User` type.
4646

4747
## How to run TypeScript code
4848

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

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ 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 in future versions of Node.js.
88
99
# Running TypeScript Natively
1010

@@ -14,22 +14,22 @@ In the previous articles, we learned how to run TypeScript code using transpilat
1414

1515
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

17-
So how do you run typed JavaScript code with Node.js?
17+
So how do you run TypeScript code with Node.js?
1818

1919
```bash
2020
node --experimental-strip-types example.ts
2121
```
2222

2323
The `--experimental-strip-types` flag tells Node.js to strip the type annotations from the TypeScript code before running it.
2424

25-
And that's it! You can now run typed JavaScript code directly in Node.js without the need to transpile it first, and use TypeScript to catch type-related errors.
26-
In the future we all hope that this feature will be stable and available in the LTS version of Node.js, so that we can all enjoy it without any additional steps.
25+
And that's it! You can now run TypeScript code directly in Node.js without the need to transpile it first, and use TypeScript to catch type-related errors.
26+
Future versions of Node.js will include support for TypeScript without the need for a command line flag.
2727

2828
## Limitations
2929

30-
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.
30+
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.
3131

32-
You can get more information on the [api docs](https://nodejs.org/docs/latest/api/typescript.html#unsupported-typescript-features)
32+
You can get more information on the [API docs](https://nodejs.org/docs/latest/api/typescript.html#unsupported-typescript-features)
3333

3434
## Important notes
3535

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In the previous article, we learned how to run TypeScript code using transpilati
1010

1111
## Running TypeScript code with `ts-node`
1212

13-
[ts-node](https://typestrong.org/ts-node/) is a TypeScript execution environment for node.js. It allows you to run TypeScript code directly in node.js without the need to compile it first. But it's not typechecking your code. So we recommend to type check your code first with `tsc` and then run it with `ts-node` before shipping it.
13+
[ts-node](https://typestrong.org/ts-node/) is a TypeScript execution environment for Node.js. It allows you to run TypeScript code directly in Node.js without the need to compile it first. Note, however, that it does not type check your code. So we recommend to type check your code first with `tsc` and then run it with `ts-node` before shipping it.
1414

1515
To use `ts-node`, you need to install it first:
1616

@@ -26,7 +26,7 @@ npx ts-node example.ts
2626

2727
## Running TypeScript code with `tsx`
2828

29-
[tsx](https://tsx.is/) is another TypeScript execution environment for node.js. It allows you to run TypeScript code directly in node.js without the need to compile it first. But it's not typechecking your code. So we recommend to type check your code first with `tsc` and then run it with `tsx` before shipping it.
29+
[tsx](https://tsx.is/) is another TypeScript execution environment for Node.js. It allows you to run TypeScript code directly in Node.js without the need to compile it first. Note, however, that it does not type check your code. So we recommend to type check your code first with `tsc` and then run it with `tsx` before shipping it.
3030

3131
To use `tsx`, you need to install it first:
3232

0 commit comments

Comments
 (0)