1{ 2 "type": "Program", 3 "statements": [ 4 { 5 "type": "TSInterfaceDeclaration", 6 "body": { 7 "type": "TSInterfaceBody", 8 "body": [ 9 { 10 "type": "TSIndexSignature", 11 "parameters": { 12 "type": "Identifier", 13 "name": "x", 14 "typeAnnotation": { 15 "type": "TSNumberKeyword", 16 "loc": { 17 "start": { 18 "line": 18, 19 "column": 9 20 }, 21 "end": { 22 "line": 18, 23 "column": 15 24 } 25 } 26 }, 27 "decorators": [], 28 "loc": { 29 "start": { 30 "line": 18, 31 "column": 6 32 }, 33 "end": { 34 "line": 18, 35 "column": 7 36 } 37 } 38 }, 39 "typeAnnotation": { 40 "type": "TSNumberKeyword", 41 "loc": { 42 "start": { 43 "line": 18, 44 "column": 18 45 }, 46 "end": { 47 "line": 18, 48 "column": 24 49 } 50 } 51 }, 52 "readonly": false, 53 "loc": { 54 "start": { 55 "line": 18, 56 "column": 5 57 }, 58 "end": { 59 "line": 18, 60 "column": 25 61 } 62 } 63 }, 64 { 65 "type": "TSIndexSignature", 66 "parameters": { 67 "type": "Identifier", 68 "name": "x", 69 "typeAnnotation": { 70 "type": "TSStringKeyword", 71 "loc": { 72 "start": { 73 "line": 19, 74 "column": 9 75 }, 76 "end": { 77 "line": 19, 78 "column": 15 79 } 80 } 81 }, 82 "decorators": [], 83 "loc": { 84 "start": { 85 "line": 19, 86 "column": 6 87 }, 88 "end": { 89 "line": 19, 90 "column": 7 91 } 92 } 93 }, 94 "typeAnnotation": { 95 "type": "TSUnionType", 96 "types": [ 97 { 98 "type": "TSNumberKeyword", 99 "loc": { 100 "start": { 101 "line": 19, 102 "column": 18 103 }, 104 "end": { 105 "line": 19, 106 "column": 24 107 } 108 } 109 }, 110 { 111 "type": "TSStringKeyword", 112 "loc": { 113 "start": { 114 "line": 19, 115 "column": 27 116 }, 117 "end": { 118 "line": 19, 119 "column": 33 120 } 121 } 122 } 123 ], 124 "loc": { 125 "start": { 126 "line": 19, 127 "column": 18 128 }, 129 "end": { 130 "line": 19, 131 "column": 33 132 } 133 } 134 }, 135 "readonly": false, 136 "loc": { 137 "start": { 138 "line": 19, 139 "column": 5 140 }, 141 "end": { 142 "line": 19, 143 "column": 34 144 } 145 } 146 } 147 ], 148 "loc": { 149 "start": { 150 "line": 17, 151 "column": 13 152 }, 153 "end": { 154 "line": 20, 155 "column": 2 156 } 157 } 158 }, 159 "id": { 160 "type": "Identifier", 161 "name": "A", 162 "decorators": [], 163 "loc": { 164 "start": { 165 "line": 17, 166 "column": 11 167 }, 168 "end": { 169 "line": 17, 170 "column": 12 171 } 172 } 173 }, 174 "extends": [], 175 "loc": { 176 "start": { 177 "line": 17, 178 "column": 1 179 }, 180 "end": { 181 "line": 20, 182 "column": 2 183 } 184 } 185 }, 186 { 187 "type": "VariableDeclaration", 188 "declarations": [ 189 { 190 "type": "VariableDeclarator", 191 "id": { 192 "type": "Identifier", 193 "name": "a", 194 "typeAnnotation": { 195 "type": "TSTypeReference", 196 "typeName": { 197 "type": "Identifier", 198 "name": "A", 199 "decorators": [], 200 "loc": { 201 "start": { 202 "line": 22, 203 "column": 8 204 }, 205 "end": { 206 "line": 22, 207 "column": 9 208 } 209 } 210 }, 211 "loc": { 212 "start": { 213 "line": 22, 214 "column": 8 215 }, 216 "end": { 217 "line": 22, 218 "column": 9 219 } 220 } 221 }, 222 "decorators": [], 223 "loc": { 224 "start": { 225 "line": 22, 226 "column": 5 227 }, 228 "end": { 229 "line": 22, 230 "column": 6 231 } 232 } 233 }, 234 "init": { 235 "type": "ObjectExpression", 236 "properties": [ 237 { 238 "type": "Property", 239 "method": false, 240 "shorthand": false, 241 "computed": false, 242 "key": { 243 "type": "NumberLiteral", 244 "value": 5, 245 "loc": { 246 "start": { 247 "line": 22, 248 "column": 14 249 }, 250 "end": { 251 "line": 22, 252 "column": 15 253 } 254 } 255 }, 256 "value": { 257 "type": "StringLiteral", 258 "value": "foo", 259 "loc": { 260 "start": { 261 "line": 22, 262 "column": 17 263 }, 264 "end": { 265 "line": 22, 266 "column": 22 267 } 268 } 269 }, 270 "kind": "init", 271 "loc": { 272 "start": { 273 "line": 22, 274 "column": 14 275 }, 276 "end": { 277 "line": 22, 278 "column": 22 279 } 280 } 281 } 282 ], 283 "loc": { 284 "start": { 285 "line": 22, 286 "column": 12 287 }, 288 "end": { 289 "line": 22, 290 "column": 24 291 } 292 } 293 }, 294 "loc": { 295 "start": { 296 "line": 22, 297 "column": 5 298 }, 299 "end": { 300 "line": 22, 301 "column": 24 302 } 303 } 304 } 305 ], 306 "kind": "var", 307 "loc": { 308 "start": { 309 "line": 22, 310 "column": 1 311 }, 312 "end": { 313 "line": 22, 314 "column": 25 315 } 316 } 317 } 318 ], 319 "loc": { 320 "start": { 321 "line": 1, 322 "column": 1 323 }, 324 "end": { 325 "line": 23, 326 "column": 1 327 } 328 } 329} 330TypeError: Type 'string' is not assignable to type 'number'. [interfaceAssignment6.ts:22:14] 331