• 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": "AssignmentPattern",
29                "left": {
30                  "type": "ArrayPattern",
31                  "elements": [
32                    {
33                      "type": "Identifier",
34                      "name": "a",
35                      "decorators": [],
36                      "loc": {
37                        "start": {
38                          "line": 17,
39                          "column": 10
40                        },
41                        "end": {
42                          "line": 17,
43                          "column": 11
44                        }
45                      }
46                    },
47                    {
48                      "type": "Identifier",
49                      "name": "b",
50                      "decorators": [],
51                      "loc": {
52                        "start": {
53                          "line": 17,
54                          "column": 13
55                        },
56                        "end": {
57                          "line": 17,
58                          "column": 14
59                        }
60                      }
61                    }
62                  ],
63                  "loc": {
64                    "start": {
65                      "line": 17,
66                      "column": 9
67                    },
68                    "end": {
69                      "line": 17,
70                      "column": 15
71                    }
72                  }
73                },
74                "right": {
75                  "type": "ArrayExpression",
76                  "elements": [
77                    {
78                      "type": "NumberLiteral",
79                      "value": 1,
80                      "loc": {
81                        "start": {
82                          "line": 17,
83                          "column": 19
84                        },
85                        "end": {
86                          "line": 17,
87                          "column": 20
88                        }
89                      }
90                    },
91                    {
92                      "type": "NumberLiteral",
93                      "value": 2,
94                      "loc": {
95                        "start": {
96                          "line": 17,
97                          "column": 22
98                        },
99                        "end": {
100                          "line": 17,
101                          "column": 23
102                        }
103                      }
104                    }
105                  ],
106                  "loc": {
107                    "start": {
108                      "line": 17,
109                      "column": 18
110                    },
111                    "end": {
112                      "line": 17,
113                      "column": 24
114                    }
115                  }
116                },
117                "loc": {
118                  "start": {
119                    "line": 17,
120                    "column": 9
121                  },
122                  "end": {
123                    "line": 17,
124                    "column": 24
125                  }
126                }
127              }
128            ],
129            "loc": {
130              "start": {
131                "line": 17,
132                "column": 5
133              },
134              "end": {
135                "line": 17,
136                "column": 25
137              }
138            }
139          },
140          "init": {
141            "type": "ArrayExpression",
142            "elements": [
143              {
144                "type": "NumberLiteral",
145                "value": 1,
146                "loc": {
147                  "start": {
148                    "line": 17,
149                    "column": 29
150                  },
151                  "end": {
152                    "line": 17,
153                    "column": 30
154                  }
155                }
156              },
157              {
158                "type": "ArrayExpression",
159                "elements": [
160                  {
161                    "type": "StringLiteral",
162                    "value": "foo",
163                    "loc": {
164                      "start": {
165                        "line": 17,
166                        "column": 33
167                      },
168                      "end": {
169                        "line": 17,
170                        "column": 38
171                      }
172                    }
173                  }
174                ],
175                "loc": {
176                  "start": {
177                    "line": 17,
178                    "column": 32
179                  },
180                  "end": {
181                    "line": 17,
182                    "column": 39
183                  }
184                }
185              }
186            ],
187            "loc": {
188              "start": {
189                "line": 17,
190                "column": 28
191              },
192              "end": {
193                "line": 17,
194                "column": 40
195              }
196            }
197          },
198          "loc": {
199            "start": {
200              "line": 17,
201              "column": 5
202            },
203            "end": {
204              "line": 17,
205              "column": 40
206            }
207          }
208        }
209      ],
210      "kind": "var",
211      "loc": {
212        "start": {
213          "line": 17,
214          "column": 1
215        },
216        "end": {
217          "line": 17,
218          "column": 41
219        }
220      }
221    }
222  ],
223  "loc": {
224    "start": {
225      "line": 1,
226      "column": 1
227    },
228    "end": {
229      "line": 17,
230      "column": 41
231    }
232  }
233}
234TypeError: Subsequent variable declaration must have the same type. Variable 'a' must be of type 'number', but here has type 'string | number'. [arrayDestructuring22.ts:17:10]
235