-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ternary operator parse error (TS 2.5) #18204
Comments
Another example of errored file https://github.com/d3/d3-interpolate/blob/master/src/string.js |
Duplicated/related to #16241 (see my last comment). Tested, and your sample works with 2.4.2 and not 2.5.2. Seems like the compiler has some ambiguity errors with ternary operator with both (ts ans js). |
Possibly related to #18123 |
Thanks @j-oliveras for the pointer. This is indeed a dupe of #16241 — it now manifests with the The workaround is to not parenthesize the true branch of the ternary, because this makes the parser think that it could be looking at the start of an arrow function. |
TypeScript Version: 2.5.2
Code
> tsc script.js --allowJs --outFile result.js
Expected behavior:
Should compile OK
Actual behavior:
TypeScript 2.4.1 worked OK.
The text was updated successfully, but these errors were encountered: