-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Correctly parse
cls.fn<C> = x
(#16476)
* fix TSInstantiationExpression * update tests
- Loading branch information
1 parent
b1c8837
commit 4bd1b2c
Showing
10 changed files
with
760 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
18 changes: 18 additions & 0 deletions
18
...abel-parser/test/fixtures/typescript/assign/TSTypeParameterInstantiation-babel-7/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,18 @@ | ||
export abstract class AbstractClass { | ||
public static myFunc?: <M extends AbstractClass>( | ||
this: AbstractClass, | ||
instance: M, | ||
) => void; | ||
} | ||
|
||
export class ConcreteClass extends AbstractClass { | ||
declare myField: string; | ||
} | ||
|
||
export const init = () => { | ||
const cls = ConcreteClass; | ||
|
||
cls.myFunc<ConcreteClass> = (instance) => { | ||
console.log(instance.myField); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...-parser/test/fixtures/typescript/assign/TSTypeParameterInstantiation-babel-7/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 @@ | ||
{ | ||
"BABEL_8_BREAKING": false, | ||
"plugins": ["typescript"] | ||
} |
336 changes: 336 additions & 0 deletions
336
...l-parser/test/fixtures/typescript/assign/TSTypeParameterInstantiation-babel-7/output.json
Large diffs are not rendered by default.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
packages/babel-parser/test/fixtures/typescript/assign/TSTypeParameterInstantiation/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,18 @@ | ||
export abstract class AbstractClass { | ||
public static myFunc?: <M extends AbstractClass>( | ||
this: AbstractClass, | ||
instance: M, | ||
) => void; | ||
} | ||
|
||
export class ConcreteClass extends AbstractClass { | ||
declare myField: string; | ||
} | ||
|
||
export const init = () => { | ||
const cls = ConcreteClass; | ||
|
||
cls.myFunc<ConcreteClass> = (instance) => { | ||
console.log(instance.myField); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...es/babel-parser/test/fixtures/typescript/assign/TSTypeParameterInstantiation/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 @@ | ||
{ | ||
"BABEL_8_BREAKING": true, | ||
"plugins": ["typescript"] | ||
} |
340 changes: 340 additions & 0 deletions
340
...ges/babel-parser/test/fixtures/typescript/assign/TSTypeParameterInstantiation/output.json
Large diffs are not rendered by default.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...l-plugin-transform-typescript/test/fixtures/lvalues/TSTypeParameterInstantiation/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,18 @@ | ||
export abstract class AbstractClass { | ||
public static myFunc?: <M extends AbstractClass>( | ||
this: AbstractClass, | ||
instance: M, | ||
) => void; | ||
} | ||
|
||
export class ConcreteClass extends AbstractClass { | ||
declare myField: string; | ||
} | ||
|
||
export const init = () => { | ||
const cls = ConcreteClass; | ||
|
||
cls.myFunc<ConcreteClass> = (instance) => { | ||
console.log(instance.myField); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
...ugin-transform-typescript/test/fixtures/lvalues/TSTypeParameterInstantiation/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,11 @@ | ||
{ | ||
"sourceType": "module", | ||
"plugins": [ | ||
[ | ||
"transform-typescript", | ||
{ | ||
"allowDeclareFields": true | ||
} | ||
] | ||
] | ||
} |
10 changes: 10 additions & 0 deletions
10
...plugin-transform-typescript/test/fixtures/lvalues/TSTypeParameterInstantiation/output.mjs
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,10 @@ | ||
export class AbstractClass { | ||
static myFunc; | ||
} | ||
export class ConcreteClass extends AbstractClass {} | ||
export const init = () => { | ||
const cls = ConcreteClass; | ||
cls.myFunc = instance => { | ||
console.log(instance.myField); | ||
}; | ||
}; |