1{ 2 "type": "Program", 3 "statements": [ 4 { 5 "type": "TSInterfaceDeclaration", 6 "body": { 7 "type": "TSInterfaceBody", 8 "body": [ 9 { 10 "type": "TSPropertySignature", 11 "computed": false, 12 "optional": false, 13 "readonly": false, 14 "key": { 15 "type": "Identifier", 16 "name": "a", 17 "decorators": [], 18 "loc": { 19 "start": { 20 "line": 18, 21 "column": 5 22 }, 23 "end": { 24 "line": 18, 25 "column": 6 26 } 27 } 28 }, 29 "typeAnnotation": { 30 "type": "TSNumberKeyword", 31 "loc": { 32 "start": { 33 "line": 18, 34 "column": 8 35 }, 36 "end": { 37 "line": 18, 38 "column": 14 39 } 40 } 41 }, 42 "loc": { 43 "start": { 44 "line": 18, 45 "column": 5 46 }, 47 "end": { 48 "line": 18, 49 "column": 15 50 } 51 } 52 }, 53 { 54 "type": "TSPropertySignature", 55 "computed": false, 56 "optional": false, 57 "readonly": false, 58 "key": { 59 "type": "Identifier", 60 "name": "b", 61 "decorators": [], 62 "loc": { 63 "start": { 64 "line": 19, 65 "column": 5 66 }, 67 "end": { 68 "line": 19, 69 "column": 6 70 } 71 } 72 }, 73 "typeAnnotation": { 74 "type": "TSArrayType", 75 "elementType": { 76 "type": "TSParenthesizedType", 77 "typeAnnotation": { 78 "type": "TSUnionType", 79 "types": [ 80 { 81 "type": "TSBooleanKeyword", 82 "loc": { 83 "start": { 84 "line": 19, 85 "column": 9 86 }, 87 "end": { 88 "line": 19, 89 "column": 16 90 } 91 } 92 }, 93 { 94 "type": "TSStringKeyword", 95 "loc": { 96 "start": { 97 "line": 19, 98 "column": 19 99 }, 100 "end": { 101 "line": 19, 102 "column": 25 103 } 104 } 105 } 106 ], 107 "loc": { 108 "start": { 109 "line": 19, 110 "column": 9 111 }, 112 "end": { 113 "line": 19, 114 "column": 25 115 } 116 } 117 }, 118 "loc": { 119 "start": { 120 "line": 19, 121 "column": 8 122 }, 123 "end": { 124 "line": 19, 125 "column": 26 126 } 127 } 128 }, 129 "loc": { 130 "start": { 131 "line": 19, 132 "column": 8 133 }, 134 "end": { 135 "line": 19, 136 "column": 28 137 } 138 } 139 }, 140 "loc": { 141 "start": { 142 "line": 19, 143 "column": 5 144 }, 145 "end": { 146 "line": 19, 147 "column": 29 148 } 149 } 150 } 151 ], 152 "loc": { 153 "start": { 154 "line": 17, 155 "column": 13 156 }, 157 "end": { 158 "line": 20, 159 "column": 2 160 } 161 } 162 }, 163 "id": { 164 "type": "Identifier", 165 "name": "A", 166 "decorators": [], 167 "loc": { 168 "start": { 169 "line": 17, 170 "column": 11 171 }, 172 "end": { 173 "line": 17, 174 "column": 12 175 } 176 } 177 }, 178 "extends": [], 179 "loc": { 180 "start": { 181 "line": 17, 182 "column": 1 183 }, 184 "end": { 185 "line": 20, 186 "column": 2 187 } 188 } 189 }, 190 { 191 "type": "VariableDeclaration", 192 "declarations": [ 193 { 194 "type": "VariableDeclarator", 195 "id": { 196 "type": "Identifier", 197 "name": "a", 198 "typeAnnotation": { 199 "type": "TSTypeReference", 200 "typeName": { 201 "type": "Identifier", 202 "name": "A", 203 "decorators": [], 204 "loc": { 205 "start": { 206 "line": 22, 207 "column": 8 208 }, 209 "end": { 210 "line": 22, 211 "column": 9 212 } 213 } 214 }, 215 "loc": { 216 "start": { 217 "line": 22, 218 "column": 8 219 }, 220 "end": { 221 "line": 22, 222 "column": 9 223 } 224 } 225 }, 226 "decorators": [], 227 "loc": { 228 "start": { 229 "line": 22, 230 "column": 5 231 }, 232 "end": { 233 "line": 22, 234 "column": 6 235 } 236 } 237 }, 238 "init": { 239 "type": "ObjectExpression", 240 "properties": [ 241 { 242 "type": "Property", 243 "method": false, 244 "shorthand": false, 245 "computed": false, 246 "key": { 247 "type": "Identifier", 248 "name": "a", 249 "decorators": [], 250 "loc": { 251 "start": { 252 "line": 22, 253 "column": 14 254 }, 255 "end": { 256 "line": 22, 257 "column": 15 258 } 259 } 260 }, 261 "value": { 262 "type": "NumberLiteral", 263 "value": 1, 264 "loc": { 265 "start": { 266 "line": 22, 267 "column": 17 268 }, 269 "end": { 270 "line": 22, 271 "column": 18 272 } 273 } 274 }, 275 "kind": "init", 276 "loc": { 277 "start": { 278 "line": 22, 279 "column": 14 280 }, 281 "end": { 282 "line": 22, 283 "column": 18 284 } 285 } 286 }, 287 { 288 "type": "Property", 289 "method": false, 290 "shorthand": false, 291 "computed": false, 292 "key": { 293 "type": "Identifier", 294 "name": "b", 295 "decorators": [], 296 "loc": { 297 "start": { 298 "line": 22, 299 "column": 20 300 }, 301 "end": { 302 "line": 22, 303 "column": 21 304 } 305 } 306 }, 307 "value": { 308 "type": "ArrayExpression", 309 "elements": [ 310 { 311 "type": "BooleanLiteral", 312 "value": true, 313 "loc": { 314 "start": { 315 "line": 22, 316 "column": 24 317 }, 318 "end": { 319 "line": 22, 320 "column": 28 321 } 322 } 323 }, 324 { 325 "type": "StringLiteral", 326 "value": "foo", 327 "loc": { 328 "start": { 329 "line": 22, 330 "column": 30 331 }, 332 "end": { 333 "line": 22, 334 "column": 35 335 } 336 } 337 }, 338 { 339 "type": "NumberLiteral", 340 "value": 2, 341 "loc": { 342 "start": { 343 "line": 22, 344 "column": 37 345 }, 346 "end": { 347 "line": 22, 348 "column": 38 349 } 350 } 351 } 352 ], 353 "loc": { 354 "start": { 355 "line": 22, 356 "column": 23 357 }, 358 "end": { 359 "line": 22, 360 "column": 39 361 } 362 } 363 }, 364 "kind": "init", 365 "loc": { 366 "start": { 367 "line": 22, 368 "column": 20 369 }, 370 "end": { 371 "line": 22, 372 "column": 39 373 } 374 } 375 } 376 ], 377 "loc": { 378 "start": { 379 "line": 22, 380 "column": 12 381 }, 382 "end": { 383 "line": 22, 384 "column": 41 385 } 386 } 387 }, 388 "loc": { 389 "start": { 390 "line": 22, 391 "column": 5 392 }, 393 "end": { 394 "line": 22, 395 "column": 41 396 } 397 } 398 } 399 ], 400 "kind": "var", 401 "loc": { 402 "start": { 403 "line": 22, 404 "column": 1 405 }, 406 "end": { 407 "line": 22, 408 "column": 42 409 } 410 } 411 } 412 ], 413 "loc": { 414 "start": { 415 "line": 1, 416 "column": 1 417 }, 418 "end": { 419 "line": 22, 420 "column": 42 421 } 422 } 423} 424TypeError: Type 'number' is not assignable to type 'boolean | string'. [interfaceAssignment4.ts:22:37] 425