-
-
Notifications
You must be signed in to change notification settings - Fork 186
Update to TypeScript 4 #914
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
Changes from all commits
fb2cf8c
eca83b6
0df7540
6d882bc
7a4bb2b
0ff5057
36e7ca1
a3eadcc
1ee6231
c6901b7
c6fabe5
bea22ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ type CompoundAssignmentToken = | |
| | ts.SyntaxKind.GreaterThanGreaterThanToken | ||
| | ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken; | ||
|
|
||
| const compoundToAssignmentTokens: Record<ts.CompoundAssignmentOperator, CompoundAssignmentToken> = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which CompoundAssignmentOperator do we not support now?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ??=, &&=, ||=
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For this PR we should either create an issue to support these compound operators later, or just revert the Partial/ | undefined changes and add them here, but then we also need some tests for them. I'm leaving it up to @hazzard993 to decide.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #916 to complete this later |
||
| const compoundToAssignmentTokens: Partial<Record<ts.CompoundAssignmentOperator, CompoundAssignmentToken>> = { | ||
| [ts.SyntaxKind.BarEqualsToken]: ts.SyntaxKind.BarToken, | ||
| [ts.SyntaxKind.PlusEqualsToken]: ts.SyntaxKind.PlusToken, | ||
| [ts.SyntaxKind.CaretEqualsToken]: ts.SyntaxKind.CaretToken, | ||
|
|
@@ -66,8 +66,9 @@ const compoundToAssignmentTokens: Record<ts.CompoundAssignmentOperator, Compound | |
| export const isCompoundAssignmentToken = (token: ts.BinaryOperator): token is ts.CompoundAssignmentOperator => | ||
| token in compoundToAssignmentTokens; | ||
|
|
||
| export const unwrapCompoundAssignmentToken = (token: ts.CompoundAssignmentOperator): CompoundAssignmentToken => | ||
| compoundToAssignmentTokens[token]; | ||
| export const unwrapCompoundAssignmentToken = ( | ||
| token: ts.CompoundAssignmentOperator | ||
| ): CompoundAssignmentToken | undefined => compoundToAssignmentTokens[token]; | ||
|
|
||
| export function transformCompoundAssignmentExpression( | ||
| context: TransformationContext, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,34 +23,6 @@ test("get accessor in base class", () => { | |
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test.skip("get accessor override", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
| _foo = "foo"; | ||
| foo = "foo"; | ||
| } | ||
| class Bar extends Foo { | ||
| get foo() { return this._foo + "bar"; } | ||
| } | ||
| const b = new Bar(); | ||
| return b.foo; | ||
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test.skip("get accessor overridden", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
| _foo = "foo"; | ||
| get foo() { return this._foo; } | ||
| } | ||
| class Bar extends Foo { | ||
| foo = "bar"; | ||
| } | ||
| const b = new Bar(); | ||
| return b.foo; | ||
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test("get accessor override accessor", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
|
|
@@ -125,37 +97,6 @@ test("set accessor in base class", () => { | |
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test("set accessor override", () => { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you check skipped tests tests, I think they shouldn't be relevant now too
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep they were too, removed them as well |
||
| util.testFunction` | ||
| class Foo { | ||
| _foo = "foo"; | ||
| foo = "foo"; | ||
| } | ||
| class Bar extends Foo { | ||
| set foo(val: string) { this._foo = val; } | ||
| } | ||
| const b = new Bar(); | ||
| b.foo = "bar" | ||
| return b._foo; | ||
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test("set accessor overridden", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
| _foo = "baz"; | ||
| set foo(val: string) { this._foo = val; } | ||
| } | ||
| class Bar extends Foo { | ||
| foo = "foo"; // triggers base class setter | ||
| } | ||
| const b = new Bar(); | ||
| const fooOriginal = b._foo; | ||
| b.foo = "bar" | ||
| return fooOriginal + b._foo; | ||
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test("set accessor override accessor", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
|
|
@@ -250,19 +191,6 @@ test("static get accessor override", () => { | |
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test.skip("static get accessor overridden", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
| static _foo = "foo"; | ||
| static get foo() { return this._foo; } | ||
| } | ||
| class Bar extends Foo { | ||
| static foo = "bar"; | ||
| } | ||
| return Bar.foo; | ||
| `.expectToMatchJsResult(); | ||
| }); | ||
|
|
||
| test("static get accessor override accessor", () => { | ||
| util.testFunction` | ||
| class Foo { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plugin version should match the parser, otherwise some rules might handle AST incorrectly. Though if it works okay with current codebase, and there would be some rules with changed configuration format, I think it's fine to keep it that way for now. I could update it to match my base config later