From 60e23025a928691780f5280d0de2371504af24a4 Mon Sep 17 00:00:00 2001 From: Mongkii Date: Fri, 16 Oct 2020 13:39:26 +0000 Subject: [PATCH] test: add test case for babel-parser: fixtures/typescript/arrow-function/destructuring-with-annotation-newline --- .../input.ts | 3 + .../output.json | 104 ++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/input.ts create mode 100644 packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/output.json diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/input.ts b/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/input.ts new file mode 100644 index 000000000000..cab5caeb40e7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/input.ts @@ -0,0 +1,3 @@ +( + { a, b }: T, +): T => {}; \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/output.json b/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/output.json new file mode 100644 index 000000000000..de2d4df6ccd6 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/arrow-function/destructuring-with-annotation-newline/output.json @@ -0,0 +1,104 @@ +{ + "type": "File", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":11}}, + "program": { + "type": "Program", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":11}}, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start":0,"end":28,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":11}}, + "expression": { + "type": "ArrowFunctionExpression", + "start":0,"end":27,"loc":{"start":{"line":1,"column":0},"end":{"line":3,"column":10}}, + "returnType": { + "type": "TSTypeAnnotation", + "start":18,"end":21,"loc":{"start":{"line":3,"column":1},"end":{"line":3,"column":4}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":20,"end":21,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4}}, + "typeName": { + "type": "Identifier", + "start":20,"end":21,"loc":{"start":{"line":3,"column":3},"end":{"line":3,"column":4},"identifierName":"T"}, + "name": "T" + } + } + }, + "id": null, + "generator": false, + "async": false, + "params": [ + { + "type": "ObjectPattern", + "start":4,"end":15,"loc":{"start":{"line":2,"column":2},"end":{"line":2,"column":13}}, + "properties": [ + { + "type": "ObjectProperty", + "start":6,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5}}, + "extra": { + "shorthand": true + }, + "method":false, + "key": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, + "name": "a" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":6,"end":7,"loc":{"start":{"line":2,"column":4},"end":{"line":2,"column":5},"identifierName":"a"}, + "name": "a" + } + }, + { + "type": "ObjectProperty", + "start":9,"end":10,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}, + "extra": { + "shorthand": true + }, + "method": false, + "key": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"b"}, + "name": "b" + }, + "computed": false, + "shorthand": true, + "value": { + "type": "Identifier", + "start":9,"end":10,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":8},"identifierName":"b"}, + "name": "b" + } + } + ], + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start":12,"end":15,"loc":{"start":{"line":2,"column":10},"end":{"line":2,"column":13}}, + "typeAnnotation": { + "type": "TSTypeReference", + "start":14,"end":15,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13}}, + "typeName": { + "type": "Identifier", + "start":14,"end":15,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":13},"identifierName":"T"}, + "name": "T" + } + } + } + } + ], + "body": { + "type": "BlockStatement", + "start":25,"end":27,"loc":{"start":{"line":3,"column":8},"end":{"line":3,"column":10}}, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file