Skip to content

Commit

Permalink
Add a test for swc-project#573
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Jan 7, 2020
1 parent 02d4fb6 commit 816f77f
Show file tree
Hide file tree
Showing 2 changed files with 164 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
const fn = <T extends string | number>(x: T) => x;
163 changes: 163 additions & 0 deletions ecmascript/parser/tests/typescript/custom/issue-573/input.tsx.json
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit 816f77f

Please sign in to comment.