swc/crates/swc_ecma_parser/tests/tsc/optionalProperties01.json

373 lines
9.3 KiB
JSON
Raw Normal View History

{
"type": "Script",
"span": {
2022-02-04 14:17:42 +03:00
"start": 50,
"end": 236,
"ctxt": 0
},
"body": [
{
"type": "TsInterfaceDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 50,
"end": 130,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 60,
"end": 63,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"declare": false,
"typeParams": null,
"extends": [],
"body": {
"type": "TsInterfaceBody",
"span": {
2022-02-04 14:17:42 +03:00
"start": 64,
"end": 130,
"ctxt": 0
},
"body": [
{
"type": "TsPropertySignature",
"span": {
2022-02-04 14:17:42 +03:00
"start": 68,
"end": 86,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 68,
"end": 77,
"ctxt": 0
},
"value": "required1",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 77,
"end": 85,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 79,
"end": 85,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
2022-02-04 14:17:42 +03:00
"start": 89,
"end": 107,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 89,
"end": 98,
"ctxt": 0
},
"value": "required2",
"optional": false
},
"computed": false,
"optional": false,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 98,
"end": 106,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 100,
"end": 106,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
},
{
"type": "TsPropertySignature",
"span": {
2022-02-04 14:17:42 +03:00
"start": 110,
"end": 128,
"ctxt": 0
},
"readonly": false,
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 110,
"end": 118,
"ctxt": 0
},
"value": "optional",
"optional": false
},
"computed": false,
"optional": true,
"init": null,
"params": [],
"typeAnnotation": {
"type": "TsTypeAnnotation",
"span": {
2022-02-04 14:17:42 +03:00
"start": 119,
"end": 127,
"ctxt": 0
},
"typeAnnotation": {
"type": "TsKeywordType",
"span": {
2022-02-04 14:17:42 +03:00
"start": 121,
"end": 127,
"ctxt": 0
},
"kind": "string"
}
},
"typeParams": null
}
]
}
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 132,
"end": 175,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 138,
"end": 174,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 138,
"end": 142,
"ctxt": 0
},
"value": "foo1",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 145,
"end": 174,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 145,
"end": 167,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 147,
"end": 156,
"ctxt": 0
},
"value": "required1",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 158,
"end": 165,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
2022-02-04 14:17:42 +03:00
"start": 171,
"end": 174,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 171,
"end": 174,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
},
{
"type": "VariableDeclaration",
"span": {
2022-02-04 14:17:42 +03:00
"start": 176,
"end": 236,
"ctxt": 0
},
"kind": "const",
"declare": false,
"declarations": [
{
"type": "VariableDeclarator",
"span": {
2022-02-04 14:17:42 +03:00
"start": 182,
"end": 235,
"ctxt": 0
},
"id": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 182,
"end": 186,
"ctxt": 0
},
"value": "foo2",
"optional": false,
"typeAnnotation": null
},
"init": {
"type": "TsAsExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 189,
"end": 235,
"ctxt": 0
},
"expression": {
"type": "ObjectExpression",
"span": {
2022-02-04 14:17:42 +03:00
"start": 189,
"end": 228,
"ctxt": 0
},
"properties": [
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 191,
"end": 200,
"ctxt": 0
},
"value": "required1",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 202,
"end": 209,
"ctxt": 0
},
"value": "hello",
"raw": "\"hello\""
}
},
{
"type": "KeyValueProperty",
"key": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 211,
"end": 219,
"ctxt": 0
},
"value": "optional",
"optional": false
},
"value": {
"type": "StringLiteral",
"span": {
2022-02-04 14:17:42 +03:00
"start": 221,
"end": 226,
"ctxt": 0
},
"value": "bar",
"raw": "\"bar\""
}
}
]
},
"typeAnnotation": {
"type": "TsTypeReference",
"span": {
2022-02-04 14:17:42 +03:00
"start": 232,
"end": 235,
"ctxt": 0
},
"typeName": {
"type": "Identifier",
"span": {
2022-02-04 14:17:42 +03:00
"start": 232,
"end": 235,
"ctxt": 0
},
"value": "Foo",
"optional": false
},
"typeParams": null
}
},
"definite": false
}
]
}
],
"interpreter": null
}