{ "type": "Program", "statements": [ { "type": "TSInterfaceDeclaration", "body": { "type": "TSInterfaceBody", "body": [ { "type": "TSPropertySignature", "computed": false, "optional": false, "readonly": false, "key": { "type": "Identifier", "name": "a", "decorators": [], "loc": { "start": { "line": 18, "column": 5 }, "end": { "line": 18, "column": 6 } } }, "typeAnnotation": { "type": "TSNumberKeyword", "loc": { "start": { "line": 18, "column": 8 }, "end": { "line": 18, "column": 14 } } }, "loc": { "start": { "line": 18, "column": 5 }, "end": { "line": 18, "column": 15 } } }, { "type": "TSPropertySignature", "computed": false, "optional": false, "readonly": false, "key": { "type": "Identifier", "name": "b", "decorators": [], "loc": { "start": { "line": 19, "column": 5 }, "end": { "line": 19, "column": 6 } } }, "typeAnnotation": { "type": "TSArrayType", "elementType": { "type": "TSParenthesizedType", "typeAnnotation": { "type": "TSUnionType", "types": [ { "type": "TSBooleanKeyword", "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 16 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 19, "column": 19 }, "end": { "line": 19, "column": 25 } } } ], "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 25 } } }, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 26 } } }, "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 28 } } }, "loc": { "start": { "line": 19, "column": 5 }, "end": { "line": 19, "column": 29 } } } ], "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 20, "column": 2 } } }, "id": { "type": "Identifier", "name": "A", "decorators": [], "loc": { "start": { "line": 17, "column": 11 }, "end": { "line": 17, "column": 12 } } }, "extends": [], "loc": { "start": { "line": 17, "column": 1 }, "end": { "line": 20, "column": 2 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSTypeReference", "typeName": { "type": "Identifier", "name": "A", "decorators": [], "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 9 } } }, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 22, "column": 9 } } }, "decorators": [], "loc": { "start": { "line": 22, "column": 5 }, "end": { "line": 22, "column": 6 } } }, "init": { "type": "ObjectExpression", "properties": [ { "type": "Property", "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "name": "a", "decorators": [], "loc": { "start": { "line": 22, "column": 14 }, "end": { "line": 22, "column": 15 } } }, "value": { "type": "NumberLiteral", "value": 1, "loc": { "start": { "line": 22, "column": 17 }, "end": { "line": 22, "column": 18 } } }, "kind": "init", "loc": { "start": { "line": 22, "column": 14 }, "end": { "line": 22, "column": 18 } } }, { "type": "Property", "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "name": "b", "decorators": [], "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 22, "column": 21 } } }, "value": { "type": "ArrayExpression", "elements": [ { "type": "BooleanLiteral", "value": true, "loc": { "start": { "line": 22, "column": 24 }, "end": { "line": 22, "column": 28 } } }, { "type": "StringLiteral", "value": "foo", "loc": { "start": { "line": 22, "column": 30 }, "end": { "line": 22, "column": 35 } } }, { "type": "NumberLiteral", "value": 2, "loc": { "start": { "line": 22, "column": 37 }, "end": { "line": 22, "column": 38 } } } ], "loc": { "start": { "line": 22, "column": 23 }, "end": { "line": 22, "column": 39 } } }, "kind": "init", "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 22, "column": 39 } } } ], "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 41 } } }, "loc": { "start": { "line": 22, "column": 5 }, "end": { "line": 22, "column": 41 } } } ], "kind": "var", "loc": { "start": { "line": 22, "column": 1 }, "end": { "line": 22, "column": 42 } } } ], "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 22, "column": 42 } } } TypeError: Type 'number' is not assignable to type 'boolean | string'. [interfaceAssignment4.ts:22:37]