swc/crates/swc_ecma_parser/tests/tsc/optionalProperties01.json
2022-02-04 17:08:38 +09:00

385 lines
9.7 KiB
JSON

{
"type": "Script",
"span": {
"start": 53,
"end": 246,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
"start": 53,
"end": 137,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 63,
"end": 66,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
"start": 67,
"end": 137,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
"start": 72,
"end": 90,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 72,
"end": 81,
"ctxt": 0
},
"value": "required1",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 81,
"end": 89,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 83,
"end": 89,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 94,
"end": 112,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 94,
"end": 103,
"ctxt": 0
},
"value": "required2",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 103,
"end": 111,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 105,
"end": 111,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
"start": 116,
"end": 134,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
"start": 116,
"end": 124,
"ctxt": 0
},
"value": "optional",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
"start": 125,
"end": 133,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
"start": 127,
"end": 133,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
"start": 141,
"end": 184,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 147,
"end": 183,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 147,
"end": 151,
"ctxt": 0
},
"value": "foo1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 154,
"end": 183,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 154,
"end": 176,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 156,
"end": 165,
"ctxt": 0
},
"value": "required1",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 167,
"end": 174,
"ctxt": 0
},
"value": "hello",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 180,
"end": 183,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 180,
"end": 183,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
"start": 186,
"end": 246,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
"start": 192,
"end": 245,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
"start": 192,
"end": 196,
"ctxt": 0
},
"value": "foo2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
"start": 199,
"end": 245,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
"start": 199,
"end": 238,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 201,
"end": 210,
"ctxt": 0
},
"value": "required1",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 212,
"end": 219,
"ctxt": 0
},
"value": "hello",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
"start": 221,
"end": 229,
"ctxt": 0
},
"value": "optional",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
"start": 231,
"end": 236,
"ctxt": 0
},
"value": "bar",
"hasEscape": false,
"kind": {
"type": "normal",
"containsQuote": true
}
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
"start": 242,
"end": 245,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
"start": 242,
"end": 245,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
}
],
"interpreter": null
}