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