1{ 2 "type": "Program", 3 "statements": [ 4 { 5 "type": "FunctionDeclaration", 6 "function": { 7 "type": "ScriptFunction", 8 "id": { 9 "type": "Identifier", 10 "name": "func", 11 "decorators": [], 12 "loc": { 13 "start": { 14 "line": 17, 15 "column": 10 16 }, 17 "end": { 18 "line": 17, 19 "column": 14 20 } 21 } 22 }, 23 "generator": false, 24 "async": false, 25 "expression": false, 26 "params": [ 27 { 28 "type": "Identifier", 29 "name": "a", 30 "typeAnnotation": { 31 "type": "TSNumberKeyword", 32 "loc": { 33 "start": { 34 "line": 17, 35 "column": 18 36 }, 37 "end": { 38 "line": 17, 39 "column": 24 40 } 41 } 42 }, 43 "decorators": [], 44 "loc": { 45 "start": { 46 "line": 17, 47 "column": 15 48 }, 49 "end": { 50 "line": 17, 51 "column": 16 52 } 53 } 54 } 55 ], 56 "returnType": { 57 "type": "TSNumberKeyword", 58 "loc": { 59 "start": { 60 "line": 17, 61 "column": 28 62 }, 63 "end": { 64 "line": 17, 65 "column": 34 66 } 67 } 68 }, 69 "body": { 70 "type": "BlockStatement", 71 "statements": [ 72 { 73 "type": "ExpressionStatement", 74 "expression": { 75 "type": "UpdateExpression", 76 "operator": "++", 77 "prefix": false, 78 "argument": { 79 "type": "Identifier", 80 "name": "a", 81 "decorators": [], 82 "loc": { 83 "start": { 84 "line": 18, 85 "column": 5 86 }, 87 "end": { 88 "line": 18, 89 "column": 6 90 } 91 } 92 }, 93 "loc": { 94 "start": { 95 "line": 18, 96 "column": 5 97 }, 98 "end": { 99 "line": 18, 100 "column": 8 101 } 102 } 103 }, 104 "loc": { 105 "start": { 106 "line": 18, 107 "column": 5 108 }, 109 "end": { 110 "line": 18, 111 "column": 9 112 } 113 } 114 }, 115 { 116 "type": "ReturnStatement", 117 "argument": { 118 "type": "ConditionalExpression", 119 "test": { 120 "type": "BinaryExpression", 121 "operator": "<", 122 "left": { 123 "type": "Identifier", 124 "name": "a", 125 "decorators": [], 126 "loc": { 127 "start": { 128 "line": 19, 129 "column": 12 130 }, 131 "end": { 132 "line": 19, 133 "column": 13 134 } 135 } 136 }, 137 "right": { 138 "type": "NumberLiteral", 139 "value": 0, 140 "loc": { 141 "start": { 142 "line": 19, 143 "column": 16 144 }, 145 "end": { 146 "line": 19, 147 "column": 17 148 } 149 } 150 }, 151 "loc": { 152 "start": { 153 "line": 19, 154 "column": 12 155 }, 156 "end": { 157 "line": 19, 158 "column": 17 159 } 160 } 161 }, 162 "consequent": { 163 "type": "CallExpression", 164 "callee": { 165 "type": "Identifier", 166 "name": "func", 167 "decorators": [], 168 "loc": { 169 "start": { 170 "line": 19, 171 "column": 20 172 }, 173 "end": { 174 "line": 19, 175 "column": 24 176 } 177 } 178 }, 179 "arguments": [ 180 { 181 "type": "Identifier", 182 "name": "a", 183 "decorators": [], 184 "loc": { 185 "start": { 186 "line": 19, 187 "column": 25 188 }, 189 "end": { 190 "line": 19, 191 "column": 26 192 } 193 } 194 } 195 ], 196 "optional": false, 197 "loc": { 198 "start": { 199 "line": 19, 200 "column": 20 201 }, 202 "end": { 203 "line": 19, 204 "column": 27 205 } 206 } 207 }, 208 "alternate": { 209 "type": "Identifier", 210 "name": "a", 211 "decorators": [], 212 "loc": { 213 "start": { 214 "line": 19, 215 "column": 30 216 }, 217 "end": { 218 "line": 19, 219 "column": 31 220 } 221 } 222 }, 223 "loc": { 224 "start": { 225 "line": 19, 226 "column": 12 227 }, 228 "end": { 229 "line": 19, 230 "column": 31 231 } 232 } 233 }, 234 "loc": { 235 "start": { 236 "line": 19, 237 "column": 5 238 }, 239 "end": { 240 "line": 19, 241 "column": 32 242 } 243 } 244 } 245 ], 246 "loc": { 247 "start": { 248 "line": 17, 249 "column": 35 250 }, 251 "end": { 252 "line": 20, 253 "column": 2 254 } 255 } 256 }, 257 "loc": { 258 "start": { 259 "line": 17, 260 "column": 1 261 }, 262 "end": { 263 "line": 20, 264 "column": 2 265 } 266 } 267 }, 268 "loc": { 269 "start": { 270 "line": 17, 271 "column": 1 272 }, 273 "end": { 274 "line": 20, 275 "column": 2 276 } 277 } 278 }, 279 { 280 "type": "ExpressionStatement", 281 "expression": { 282 "type": "CallExpression", 283 "callee": { 284 "type": "Identifier", 285 "name": "func", 286 "decorators": [], 287 "loc": { 288 "start": { 289 "line": 21, 290 "column": 1 291 }, 292 "end": { 293 "line": 21, 294 "column": 5 295 } 296 } 297 }, 298 "arguments": [ 299 { 300 "type": "StringLiteral", 301 "value": "foo", 302 "loc": { 303 "start": { 304 "line": 21, 305 "column": 6 306 }, 307 "end": { 308 "line": 21, 309 "column": 11 310 } 311 } 312 } 313 ], 314 "optional": false, 315 "loc": { 316 "start": { 317 "line": 21, 318 "column": 1 319 }, 320 "end": { 321 "line": 21, 322 "column": 12 323 } 324 } 325 }, 326 "loc": { 327 "start": { 328 "line": 21, 329 "column": 1 330 }, 331 "end": { 332 "line": 21, 333 "column": 13 334 } 335 } 336 } 337 ], 338 "loc": { 339 "start": { 340 "line": 1, 341 "column": 1 342 }, 343 "end": { 344 "line": 21, 345 "column": 13 346 } 347 } 348} 349TypeError: Type 'string' is not assignable to type 'number'. [functionCall_4.ts:21:6] 350