• 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": "Identifier",
11            "name": "a",
12            "typeAnnotation": {
13              "type": "TSArrayType",
14              "elementType": {
15                "type": "TSStringKeyword",
16                "loc": {
17                  "start": {
18                    "line": 17,
19                    "column": 8
20                  },
21                  "end": {
22                    "line": 17,
23                    "column": 14
24                  }
25                }
26              },
27              "loc": {
28                "start": {
29                  "line": 17,
30                  "column": 8
31                },
32                "end": {
33                  "line": 17,
34                  "column": 16
35                }
36              }
37            },
38            "decorators": [],
39            "loc": {
40              "start": {
41                "line": 17,
42                "column": 5
43              },
44              "end": {
45                "line": 17,
46                "column": 6
47              }
48            }
49          },
50          "init": null,
51          "loc": {
52            "start": {
53              "line": 17,
54              "column": 5
55            },
56            "end": {
57              "line": 17,
58              "column": 6
59            }
60          }
61        }
62      ],
63      "kind": "var",
64      "loc": {
65        "start": {
66          "line": 17,
67          "column": 1
68        },
69        "end": {
70          "line": 17,
71          "column": 17
72        }
73      }
74    },
75    {
76      "type": "ExpressionStatement",
77      "expression": {
78        "type": "AssignmentExpression",
79        "operator": "=",
80        "left": {
81          "type": "ArrayPattern",
82          "elements": [
83            {
84              "type": "Identifier",
85              "name": "a",
86              "decorators": [],
87              "loc": {
88                "start": {
89                  "line": 19,
90                  "column": 2
91                },
92                "end": {
93                  "line": 19,
94                  "column": 3
95                }
96              }
97            }
98          ],
99          "loc": {
100            "start": {
101              "line": 19,
102              "column": 1
103            },
104            "end": {
105              "line": 19,
106              "column": 4
107            }
108          }
109        },
110        "right": {
111          "type": "ArrayExpression",
112          "elements": [
113            {
114              "type": "ArrayExpression",
115              "elements": [
116                {
117                  "type": "StringLiteral",
118                  "value": "foo",
119                  "loc": {
120                    "start": {
121                      "line": 19,
122                      "column": 9
123                    },
124                    "end": {
125                      "line": 19,
126                      "column": 14
127                    }
128                  }
129                },
130                {
131                  "type": "NumberLiteral",
132                  "value": 1,
133                  "loc": {
134                    "start": {
135                      "line": 19,
136                      "column": 16
137                    },
138                    "end": {
139                      "line": 19,
140                      "column": 17
141                    }
142                  }
143                }
144              ],
145              "loc": {
146                "start": {
147                  "line": 19,
148                  "column": 8
149                },
150                "end": {
151                  "line": 19,
152                  "column": 18
153                }
154              }
155            }
156          ],
157          "loc": {
158            "start": {
159              "line": 19,
160              "column": 7
161            },
162            "end": {
163              "line": 19,
164              "column": 19
165            }
166          }
167        },
168        "loc": {
169          "start": {
170            "line": 19,
171            "column": 1
172          },
173          "end": {
174            "line": 19,
175            "column": 19
176          }
177        }
178      },
179      "loc": {
180        "start": {
181          "line": 19,
182          "column": 1
183        },
184        "end": {
185          "line": 19,
186          "column": 19
187        }
188      }
189    }
190  ],
191  "loc": {
192    "start": {
193      "line": 1,
194      "column": 1
195    },
196    "end": {
197      "line": 19,
198      "column": 19
199    }
200  }
201}
202TypeError: Type '(string | number)[]' is not assignable to type 'string[]'. [arrayDestructuring42.ts:19:2]
203