{ "type": "Program", "statements": [ { "type": "TSInterfaceDeclaration", "body": { "type": "TSInterfaceBody", "body": [ { "type": "TSIndexSignature", "parameters": { "type": "Identifier", "name": "x", "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 } } }, "typeAnnotation": { "type": "TSNumberKeyword", "loc": { "start": { "line": 18, "column": 18 }, "end": { "line": 18, "column": 24 } } }, "readonly": false, "loc": { "start": { "line": 18, "column": 5 }, "end": { "line": 18, "column": 25 } } }, { "type": "TSIndexSignature", "parameters": { "type": "Identifier", "name": "x", "typeAnnotation": { "type": "TSStringKeyword", "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 19, "column": 15 } } }, "decorators": [], "loc": { "start": { "line": 19, "column": 6 }, "end": { "line": 19, "column": 7 } } }, "typeAnnotation": { "type": "TSUnionType", "types": [ { "type": "TSNumberKeyword", "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 24 } } }, { "type": "TSStringKeyword", "loc": { "start": { "line": 19, "column": 27 }, "end": { "line": 19, "column": 33 } } } ], "loc": { "start": { "line": 19, "column": 18 }, "end": { "line": 19, "column": 33 } } }, "readonly": false, "loc": { "start": { "line": 19, "column": 5 }, "end": { "line": 19, "column": 34 } } } ], "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": "NumberLiteral", "value": 5, "loc": { "start": { "line": 22, "column": 14 }, "end": { "line": 22, "column": 15 } } }, "value": { "type": "StringLiteral", "value": "foo", "loc": { "start": { "line": 22, "column": 17 }, "end": { "line": 22, "column": 22 } } }, "kind": "init", "loc": { "start": { "line": 22, "column": 14 }, "end": { "line": 22, "column": 22 } } } ], "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 24 } } }, "loc": { "start": { "line": 22, "column": 5 }, "end": { "line": 22, "column": 24 } } } ], "kind": "var", "loc": { "start": { "line": 22, "column": 1 }, "end": { "line": 22, "column": 25 } } } ], "loc": { "start": { "line": 1, "column": 1 }, "end": { "line": 23, "column": 1 } } } TypeError: Type 'string' is not assignable to type 'number'. [interfaceAssignment6.ts:22:14]