• 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": "ArrayPattern",
11            "elements": [
12              {
13                "type": "Identifier",
14                "name": "a",
15                "decorators": [],
16                "loc": {
17                  "start": {
18                    "line": 17,
19                    "column": 6
20                  },
21                  "end": {
22                    "line": 17,
23                    "column": 7
24                  }
25                }
26              },
27              {
28                "type": "Identifier",
29                "name": "b",
30                "decorators": [],
31                "loc": {
32                  "start": {
33                    "line": 17,
34                    "column": 9
35                  },
36                  "end": {
37                    "line": 17,
38                    "column": 10
39                  }
40                }
41              }
42            ],
43            "typeAnnotation": {
44              "type": "TSUnionType",
45              "types": [
46                {
47                  "type": "TSArrayType",
48                  "elementType": {
49                    "type": "TSNumberKeyword",
50                    "loc": {
51                      "start": {
52                        "line": 17,
53                        "column": 13
54                      },
55                      "end": {
56                        "line": 17,
57                        "column": 19
58                      }
59                    }
60                  },
61                  "loc": {
62                    "start": {
63                      "line": 17,
64                      "column": 13
65                    },
66                    "end": {
67                      "line": 17,
68                      "column": 21
69                    }
70                  }
71                },
72                {
73                  "type": "TSTupleType",
74                  "elementTypes": [
75                    {
76                      "type": "TSStringKeyword",
77                      "loc": {
78                        "start": {
79                          "line": 17,
80                          "column": 25
81                        },
82                        "end": {
83                          "line": 17,
84                          "column": 32
85                        }
86                      }
87                    },
88                    {
89                      "type": "TSNumberKeyword",
90                      "loc": {
91                        "start": {
92                          "line": 17,
93                          "column": 33
94                        },
95                        "end": {
96                          "line": 17,
97                          "column": 40
98                        }
99                      }
100                    }
101                  ],
102                  "loc": {
103                    "start": {
104                      "line": 17,
105                      "column": 24
106                    },
107                    "end": {
108                      "line": 17,
109                      "column": 40
110                    }
111                  }
112                }
113              ],
114              "loc": {
115                "start": {
116                  "line": 17,
117                  "column": 13
118                },
119                "end": {
120                  "line": 17,
121                  "column": 40
122                }
123              }
124            },
125            "loc": {
126              "start": {
127                "line": 17,
128                "column": 5
129              },
130              "end": {
131                "line": 17,
132                "column": 11
133              }
134            }
135          },
136          "init": {
137            "type": "ArrayExpression",
138            "elements": [
139              {
140                "type": "NumberLiteral",
141                "value": 1,
142                "loc": {
143                  "start": {
144                    "line": 17,
145                    "column": 44
146                  },
147                  "end": {
148                    "line": 17,
149                    "column": 45
150                  }
151                }
152              },
153              {
154                "type": "NumberLiteral",
155                "value": 2,
156                "loc": {
157                  "start": {
158                    "line": 17,
159                    "column": 47
160                  },
161                  "end": {
162                    "line": 17,
163                    "column": 48
164                  }
165                }
166              }
167            ],
168            "loc": {
169              "start": {
170                "line": 17,
171                "column": 43
172              },
173              "end": {
174                "line": 17,
175                "column": 49
176              }
177            }
178          },
179          "loc": {
180            "start": {
181              "line": 17,
182              "column": 5
183            },
184            "end": {
185              "line": 17,
186              "column": 49
187            }
188          }
189        }
190      ],
191      "kind": "var",
192      "loc": {
193        "start": {
194          "line": 17,
195          "column": 1
196        },
197        "end": {
198          "line": 17,
199          "column": 50
200        }
201      }
202    },
203    {
204      "type": "ExpressionStatement",
205      "expression": {
206        "type": "AssignmentExpression",
207        "operator": "=",
208        "left": {
209          "type": "Identifier",
210          "name": "a",
211          "decorators": [],
212          "loc": {
213            "start": {
214              "line": 18,
215              "column": 1
216            },
217            "end": {
218              "line": 18,
219              "column": 2
220            }
221          }
222        },
223        "right": {
224          "type": "ObjectExpression",
225          "properties": [],
226          "loc": {
227            "start": {
228              "line": 18,
229              "column": 5
230            },
231            "end": {
232              "line": 18,
233              "column": 7
234            }
235          }
236        },
237        "loc": {
238          "start": {
239            "line": 18,
240            "column": 1
241          },
242          "end": {
243            "line": 18,
244            "column": 7
245          }
246        }
247      },
248      "loc": {
249        "start": {
250          "line": 18,
251          "column": 1
252        },
253        "end": {
254          "line": 18,
255          "column": 8
256        }
257      }
258    }
259  ],
260  "loc": {
261    "start": {
262      "line": 1,
263      "column": 1
264    },
265    "end": {
266      "line": 18,
267      "column": 8
268    }
269  }
270}
271TypeError: Type '{ }' is not assignable to type 'number | string'. [arrayDestructuring6.ts:18:1]
272