From 816f77f49f82c85995c60b920ba4eae6de49a086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 7 Jan 2020 21:05:29 +0900 Subject: [PATCH] Add a test for #573 --- .../typescript/custom/issue-573/input.tsx | 1 + .../custom/issue-573/input.tsx.json | 163 ++++++++++++++++++ 2 files changed, 164 insertions(+) create mode 100644 ecmascript/parser/tests/typescript/custom/issue-573/input.tsx create mode 100644 ecmascript/parser/tests/typescript/custom/issue-573/input.tsx.json diff --git a/ecmascript/parser/tests/typescript/custom/issue-573/input.tsx b/ecmascript/parser/tests/typescript/custom/issue-573/input.tsx new file mode 100644 index 000000000000..24366284db6c --- /dev/null +++ b/ecmascript/parser/tests/typescript/custom/issue-573/input.tsx @@ -0,0 +1 @@ +const fn = (x: T) => x; \ No newline at end of file diff --git a/ecmascript/parser/tests/typescript/custom/issue-573/input.tsx.json b/ecmascript/parser/tests/typescript/custom/issue-573/input.tsx.json new file mode 100644 index 000000000000..78275f874a69 --- /dev/null +++ b/ecmascript/parser/tests/typescript/custom/issue-573/input.tsx.json @@ -0,0 +1,163 @@ +{ + "type": "Module", + "span": { + "start": 0, + "end": 50, + "ctxt": 0 + }, + "body": [ + { + "type": "VariableDeclaration", + "span": { + "start": 0, + "end": 50, + "ctxt": 0 + }, + "kind": "const", + "declare": false, + "declarations": [ + { + "type": "VariableDeclarator", + "span": { + "start": 6, + "end": 49, + "ctxt": 0 + }, + "id": { + "type": "Identifier", + "span": { + "start": 6, + "end": 8, + "ctxt": 0 + }, + "value": "fn", + "typeAnnotation": null, + "optional": false + }, + "init": { + "type": "ArrowFunctionExpression", + "span": { + "start": 38, + "end": 49, + "ctxt": 0 + }, + "params": [ + { + "type": "Identifier", + "span": { + "start": 39, + "end": 43, + "ctxt": 0 + }, + "value": "x", + "typeAnnotation": { + "type": "TsTypeAnnotation", + "span": { + "start": 40, + "end": 43, + "ctxt": 0 + }, + "typeAnnotation": { + "type": "TsTypeReference", + "span": { + "start": 42, + "end": 43, + "ctxt": 0 + }, + "typeName": { + "type": "Identifier", + "span": { + "start": 42, + "end": 43, + "ctxt": 0 + }, + "value": "T", + "typeAnnotation": null, + "optional": false + }, + "typeParams": null + } + }, + "optional": false + } + ], + "body": { + "type": "Identifier", + "span": { + "start": 48, + "end": 49, + "ctxt": 0 + }, + "value": "x", + "typeAnnotation": null, + "optional": false + }, + "async": false, + "generator": false, + "typeParameters": { + "type": "TsTypeParameterDeclaration", + "span": { + "start": 11, + "end": 38, + "ctxt": 0 + }, + "parameters": [ + { + "type": "TsTypeParameter", + "span": { + "start": 12, + "end": 37, + "ctxt": 0 + }, + "name": { + "type": "Identifier", + "span": { + "start": 12, + "end": 13, + "ctxt": 0 + }, + "value": "T", + "typeAnnotation": null, + "optional": false + }, + "constraint": { + "type": "TsUnionType", + "span": { + "start": 22, + "end": 37, + "ctxt": 0 + }, + "types": [ + { + "type": "TsKeywordType", + "span": { + "start": 22, + "end": 28, + "ctxt": 0 + }, + "kind": "string" + }, + { + "type": "TsKeywordType", + "span": { + "start": 31, + "end": 37, + "ctxt": 0 + }, + "kind": "number" + } + ] + }, + "default": null + } + ] + }, + "returnType": null + }, + "definite": false + } + ] + } + ], + "interpreter": null +}