TypeScript Version: 3.3.0-dev.20181222
Search Terms:
Code
// @filename: test.js
function test(...args,) {} // trailing comma not allowed
class C {
async static foo() {} // modifiers are in the wrong order
}
@decorator // invalid decorator location
async var v = 1; // invalid modifier location
let {...rest: rest} = {}; // rest property cannot have a property name
Expected behavior:
All errors above are reported in JS files as they result in parse errors when executed.
Actual behavior:
The above file has no errors. They are not reported as syntax errors because TypeScript's parser is more permissive than the spec in many cases. Since grammar errors are only reported during type-checking they are ignored in JS files without // @ts-check.
Other JS parsers, e.g. javascript VMs, emit a parse error for the code above.
Related Issues:
#6107 suggests moving grammar errors to the binding phase
#6802
TypeScript Version: 3.3.0-dev.20181222
Search Terms:
Code
Expected behavior:
All errors above are reported in JS files as they result in parse errors when executed.
Actual behavior:
The above file has no errors. They are not reported as syntax errors because TypeScript's parser is more permissive than the spec in many cases. Since grammar errors are only reported during type-checking they are ignored in JS files without
// @ts-check.Other JS parsers, e.g. javascript VMs, emit a parse error for the code above.
Related Issues:
#6107 suggests moving grammar errors to the binding phase
#6802