Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not register ambient classes to the TS scope (#10352)
- Loading branch information
1 parent
11ed2e2
commit 15aa511
Showing
10 changed files
with
468 additions
and
8 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
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
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/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,2 @@ | ||
declare class C { } | ||
declare function C(): void; |
151 changes: 151 additions & 0 deletions
151
packages/babel-parser/test/fixtures/typescript/scope/callable-class-ambient/output.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,151 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 47, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 27 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 47, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 27 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start": 0, | ||
"end": 19, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 19 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 14, | ||
"end": 15, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
}, | ||
"identifierName": "C" | ||
}, | ||
"name": "C" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start": 16, | ||
"end": 19, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 19 | ||
} | ||
}, | ||
"body": [] | ||
}, | ||
"declare": true | ||
}, | ||
{ | ||
"type": "TSDeclareFunction", | ||
"start": 20, | ||
"end": 47, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 27 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 37, | ||
"end": 38, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 17 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 18 | ||
}, | ||
"identifierName": "C" | ||
}, | ||
"name": "C" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"returnType": { | ||
"type": "TSTypeAnnotation", | ||
"start": 40, | ||
"end": 46, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 20 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 26 | ||
} | ||
}, | ||
"typeAnnotation": { | ||
"type": "TSVoidKeyword", | ||
"start": 42, | ||
"end": 46, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 22 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 26 | ||
} | ||
} | ||
} | ||
}, | ||
"declare": true | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
packages/babel-parser/test/fixtures/typescript/scope/callable-class/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,2 @@ | ||
declare class C { } | ||
function C() { } |
137 changes: 137 additions & 0 deletions
137
packages/babel-parser/test/fixtures/typescript/scope/callable-class/output.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,137 @@ | ||
{ | ||
"type": "File", | ||
"start": 0, | ||
"end": 36, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 16 | ||
} | ||
}, | ||
"program": { | ||
"type": "Program", | ||
"start": 0, | ||
"end": 36, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 16 | ||
} | ||
}, | ||
"sourceType": "module", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start": 0, | ||
"end": 19, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 19 | ||
} | ||
}, | ||
"declare": true, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 14, | ||
"end": 15, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 14 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 15 | ||
}, | ||
"identifierName": "C" | ||
}, | ||
"name": "C" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start": 16, | ||
"end": 19, | ||
"loc": { | ||
"start": { | ||
"line": 1, | ||
"column": 16 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"column": 19 | ||
} | ||
}, | ||
"body": [] | ||
} | ||
}, | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start": 20, | ||
"end": 36, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 0 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 16 | ||
} | ||
}, | ||
"id": { | ||
"type": "Identifier", | ||
"start": 29, | ||
"end": 30, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 9 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 10 | ||
}, | ||
"identifierName": "C" | ||
}, | ||
"name": "C" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"body": { | ||
"type": "BlockStatement", | ||
"start": 33, | ||
"end": 36, | ||
"loc": { | ||
"start": { | ||
"line": 2, | ||
"column": 13 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"column": 16 | ||
} | ||
}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
Oops, something went wrong.