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