Skip to content
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

Add legality update on Special Static Names in ES2022 #3299

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions packages/documentation/copy/en/handbook-v2/Classes.md
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,22 @@ class S {
}
```

> This is legal starting ES2022. Note the difference between the tranpiled JavaScript files targetting ES2021 and ES2022.

```js
// javascript output targetting ES2021
class S {
}
S.name = "S!";
```

```js
// javascript output targetting ES2022
class S {
static name = "S!";
}
```

### Why No Static Classes?

TypeScript (and JavaScript) don't have a construct called `static class` the same way as, for example, C# does.
Expand Down
Loading