Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be03be1
commit 7f5b212
Showing
11 changed files
with
219 additions
and
11 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
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/dts/invalid-class-implementation/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 @@ | ||
function foo(): any {} |
42 changes: 42 additions & 0 deletions
42
packages/babel-parser/test/fixtures/typescript/dts/invalid-class-implementation/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,42 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, | ||
"errors": [ | ||
"SyntaxError: An implementation cannot be declared in ambient contexts. (1:0)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "FunctionDeclaration", | ||
"start":0,"end":22,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":22}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, | ||
"name": "foo" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [], | ||
"returnType": { | ||
"type": "TSTypeAnnotation", | ||
"start":14,"end":19,"loc":{"start":{"line":1,"column":14},"end":{"line":1,"column":19}}, | ||
"typeAnnotation": { | ||
"type": "TSAnyKeyword", | ||
"start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19}} | ||
} | ||
}, | ||
"body": { | ||
"type": "BlockStatement", | ||
"start":20,"end":22,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":22}}, | ||
"body": [], | ||
"directives": [] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/typescript/dts/invalid-class-initializer/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,3 @@ | ||
class Foo { | ||
foo = 3; | ||
} |
52 changes: 52 additions & 0 deletions
52
packages/babel-parser/test/fixtures/typescript/dts/invalid-class-initializer/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,52 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"errors": [ | ||
"SyntaxError: Initializers are not allowed in ambient contexts. (2:6)" | ||
], | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "ClassDeclaration", | ||
"start":0,"end":24,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":1}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"Foo"}, | ||
"name": "Foo" | ||
}, | ||
"superClass": null, | ||
"body": { | ||
"type": "ClassBody", | ||
"start":10,"end":24,"loc":{"start":{"line":1,"column":10},"end":{"line":3,"column":1}}, | ||
"body": [ | ||
{ | ||
"type": "ClassProperty", | ||
"start":14,"end":22,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":10}}, | ||
"static": false, | ||
"key": { | ||
"type": "Identifier", | ||
"start":14,"end":17,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":5},"identifierName":"foo"}, | ||
"name": "foo" | ||
}, | ||
"computed": false, | ||
"value": { | ||
"type": "NumericLiteral", | ||
"start":20,"end":21,"loc":{"start":{"line":2,"column":8},"end":{"line":2,"column":9}}, | ||
"extra": { | ||
"rawValue": 3, | ||
"raw": "3" | ||
}, | ||
"value": 3 | ||
} | ||
} | ||
] | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/babel-parser/test/fixtures/typescript/dts/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,3 @@ | ||
{ | ||
"plugins": [["typescript", { "dts": true }], "classProperties"] | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/dts/valid-optional-pattern/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 @@ | ||
function f([]?): any; |
40 changes: 40 additions & 0 deletions
40
packages/babel-parser/test/fixtures/typescript/dts/valid-optional-pattern/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,40 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSDeclareFunction", | ||
"start":0,"end":21,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":21}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":9,"end":10,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":10},"identifierName":"f"}, | ||
"name": "f" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "ArrayPattern", | ||
"start":11,"end":14,"loc":{"start":{"line":1,"column":11},"end":{"line":1,"column":14}}, | ||
"elements": [], | ||
"optional": true | ||
} | ||
], | ||
"returnType": { | ||
"type": "TSTypeAnnotation", | ||
"start":15,"end":20,"loc":{"start":{"line":1,"column":15},"end":{"line":1,"column":20}}, | ||
"typeAnnotation": { | ||
"type": "TSAnyKeyword", | ||
"start":17,"end":20,"loc":{"start":{"line":1,"column":17},"end":{"line":1,"column":20}} | ||
} | ||
} | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/babel-parser/test/fixtures/typescript/dts/valid-trailing-comma-for-rest/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 @@ | ||
function foo(...args: any[], ); |
47 changes: 47 additions & 0 deletions
47
packages/babel-parser/test/fixtures/typescript/dts/valid-trailing-comma-for-rest/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,47 @@ | ||
{ | ||
"type": "File", | ||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, | ||
"program": { | ||
"type": "Program", | ||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, | ||
"sourceType": "script", | ||
"interpreter": null, | ||
"body": [ | ||
{ | ||
"type": "TSDeclareFunction", | ||
"start":0,"end":31,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":31}}, | ||
"id": { | ||
"type": "Identifier", | ||
"start":9,"end":12,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":12},"identifierName":"foo"}, | ||
"name": "foo" | ||
}, | ||
"generator": false, | ||
"async": false, | ||
"params": [ | ||
{ | ||
"type": "RestElement", | ||
"start":13,"end":27,"loc":{"start":{"line":1,"column":13},"end":{"line":1,"column":27}}, | ||
"argument": { | ||
"type": "Identifier", | ||
"start":16,"end":20,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":20},"identifierName":"args"}, | ||
"name": "args" | ||
}, | ||
"typeAnnotation": { | ||
"type": "TSTypeAnnotation", | ||
"start":20,"end":27,"loc":{"start":{"line":1,"column":20},"end":{"line":1,"column":27}}, | ||
"typeAnnotation": { | ||
"type": "TSArrayType", | ||
"start":22,"end":27,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":27}}, | ||
"elementType": { | ||
"type": "TSAnyKeyword", | ||
"start":22,"end":25,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":25}} | ||
} | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"directives": [] | ||
} | ||
} |