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