-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support typescript 4.3 via babel (#10811)
* Suppor type members get/set * Add tests for static index signature in class * Support override modifier in class * Add changelog
- Loading branch information
1 parent
edc7a30
commit 711c6d0
Showing
8 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#### Support TypeScript 4.3 via `babel-ts` (#10811 by @sosukesuzuki) | ||
|
||
##### [`override` modifiers in class elements](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/#override-and-the-noimplicitoverride-flag) | ||
|
||
```ts | ||
class Foo extends { | ||
override method() {} | ||
} | ||
``` | ||
|
||
##### [static index signatures (`[key: KeyType]: ValueType`) in classes](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/#static-index-signatures) | ||
|
||
```ts | ||
class Foo { | ||
static [key: string]: Bar; | ||
} | ||
``` | ||
|
||
##### [`get` / `set` in type declarations](https://devblogs.microsoft.com/typescript/announcing-typescript-4-3-beta/#separate-write-types-on-properties) | ||
|
||
```ts | ||
interface Foo { | ||
set foo(value); | ||
get foo(): string; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/format/misc/typescript-babel-only/ts-4.3-override-modifier.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class MyClass extends BaseClass { | ||
override show() {} | ||
public override show() {} | ||
override size = 5; | ||
override readonly size = 5; | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/format/misc/typescript-babel-only/ts4.3-type-members-get-set.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
interface Foo { | ||
get foo(): string; | ||
set bar(v); | ||
} | ||
|
||
type Foo = { | ||
get foo(): string; | ||
set bar(v); | ||
} | ||
|
||
interface Foo { | ||
set bar(foo: string); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class Foo { | ||
static [value: string]: Type; | ||
} |