-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support TS 4.3
override
syntax in class (#13097)
* support TS 4.3 `override` syntax in class * fix types * fix types * tweak error message * update TypeScript commit * split tests * add more tests * update allowlist * disallow `override` with `declare` * disallow `override` in non-sub class * update TypeScript allowlist * rename error message key * add more tests
- Loading branch information
1 parent
bee2481
commit 1e7fe6a
Showing
15 changed files
with
693 additions
and
9 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
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
8 changes: 8 additions & 0 deletions
8
packages/babel-generator/test/fixtures/typescript/class-modifier-override/input.js
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,8 @@ | ||
class MyClass extends BaseClass { | ||
override show() {} | ||
override public show() {} | ||
public override show() {} | ||
override size = 5; | ||
override readonly size = 5; | ||
readonly override size = 5; | ||
} |
4 changes: 4 additions & 0 deletions
4
packages/babel-generator/test/fixtures/typescript/class-modifier-override/options.json
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,4 @@ | ||
{ | ||
"sourceType": "module", | ||
"plugins": ["typescript", "classProperties"] | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/babel-generator/test/fixtures/typescript/class-modifier-override/output.js
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,11 @@ | ||
class MyClass extends BaseClass { | ||
override show() {} | ||
|
||
override public show() {} | ||
|
||
override public show() {} | ||
|
||
override size = 5; | ||
override readonly size = 5; | ||
override readonly size = 5; | ||
} |
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
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
15 changes: 15 additions & 0 deletions
15
packages/babel-parser/test/fixtures/typescript/class/modifiers-override-errors/input.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,15 @@ | ||
class MyClass2 extends BaseClass { | ||
override constructor() {} | ||
override [x: string]: any; | ||
override static size = 5; | ||
static override size = 5; | ||
} | ||
|
||
declare class MyClass3 extends BaseClass { | ||
declare override prop1: any | ||
override declare prop2: any | ||
} | ||
|
||
class MyClass4 { | ||
override prop: any | ||
} |
Oops, something went wrong.