Open
Description
π Search Terms
as newline ASI function type parameters spec difference
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
let x = foo < 2 > as
F.getter
π Actual behavior
It is parsed as
let x = foo<2> as F.getter;
π Expected behavior
It should be parsed as
let x = (foo < 2) > as;
F.getter;
Additional information about the issue
The linked code is valid JavaScript code, and it would be great if tsc could parse as such.
I know that TS is not in general a syntactic superset of JavaScript, but both Babel and SWC already parse this example (when in TS mode) according to JS semantics. We could change our parsers, but it would be better if this ambiguity could be solved in tsc.
cc @kdy1