{ "type": "Program", "statements": [ { "type": "TSInterfaceDeclaration", "body": { "type": "TSInterfaceBody", "body": [ { "type": "TSCallSignatureDeclaration", "params": [ { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSNumberKeyword", "loc": { "start": { "line": 18, "column": 9 }, "end": { "line": 18, "column": 15 } } }, "decorators": [], "loc": { "start": { "line": 18, "column": 6 }, "end": { "line": 18, "column": 7 } } }, { "type": "Identifier", "name": "b", "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 18, "column": 20 }, "end": { "line": 18, "column": 26 } } }, "decorators": [], "loc": { "start": { "line": 18, "column": 17 }, "end": { "line": 18, "column": 18 } } } ], "returnType": { "type": "TSNumberKeyword", "loc": { "start": { "line": 18, "column": 29 }, "end": { "line": 18, "column": 35 } } }, "loc": { "start": { "line": 18, "column": 5 }, "end": { "line": 18, "column": 36 } } }, { "type": "TSPropertySignature", "computed": false, "optional": false, "readonly": false, "key": { "type": "Identifier", "name": "a", "decorators": [], "loc": { "start": { "line": 19, "column": 5 }, "end": { "line": 19, "column": 6 } } }, "typeAnnotation": { "type": "TSNumberKeyword", "loc": { "start": { "line": 19, "column": 8 }, "end": { "line": 19, "column": 14 } } }, "loc": { "start": { "line": 19, "column": 5 }, "end": { "line": 19, "column": 15 } } }, { "type": "TSPropertySignature", "computed": false, "optional": false, "readonly": false, "key": { "type": "Identifier", "name": "b", "decorators": [], "loc": { "start": { "line": 20, "column": 5 }, "end": { "line": 20, "column": 6 } } }, "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 20, "column": 14 } } }, "loc": { "start": { "line": 20, "column": 5 }, "end": { "line": 20, "column": 15 } } } ], "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 21, "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": 21, "column": 2 } } }, { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "a", "typeAnnotation": { "type": "TSTypeReference", "typeName": { "type": "Identifier", "name": "A", "decorators": [], "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 9 } } }, "loc": { "start": { "line": 23, "column": 8 }, "end": { "line": 23, "column": 9 } } }, "decorators": [], "loc": { "start": { "line": 23, "column": 5 }, "end": { "line": 23, "column": 6 } } }, "init": { "type": "ObjectExpression", "properties": [ { "type": "Property", "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "name": "a", "decorators": [], "loc": { "start": { "line": 23, "column": 14 }, "end": { "line": 23, "column": 15 } } }, "value": { "type": "NumberLiteral", "value": 5, "loc": { "start": { "line": 23, "column": 17 }, "end": { "line": 23, "column": 18 } } }, "kind": "init", "loc": { "start": { "line": 23, "column": 14 }, "end": { "line": 23, "column": 18 } } }, { "type": "Property", "method": false, "shorthand": false, "computed": false, "key": { "type": "Identifier", "name": "b", "decorators": [], "loc": { "start": { "line": 23, "column": 20 }, "end": { "line": 23, "column": 21 } } }, "value": { "type": "StringLiteral", "value": "foo", "loc": { "start": { "line": 23, "column": 23 }, "end": { "line": 23, "column": 28 } } }, "kind": "init", "loc": { "start": { "line": 23, "column": 20 }, "end": { "line": 23, "column": 28 } } } ], "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 30 } } }, "loc": { "start": { "line": 23, "column": 5 }, "end": { "line": 23, "column": 30 } } } ], "kind": "var", "loc": { "start": { "line": 23, "column": 1 }, "end": { "line": 23, "column": 31 } } } ], "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 23, "column": 31 } } } TypeError: Type '{ a: 5; b: "foo"; }' is not assignable to type 'A'. [interfaceAssignment7.ts:23:5]