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