-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
TS 4.7 syntax regression: ';' expected. #48711
Comments
This is new ASI hazard introduced by instantiation expressions, because |
I'm surprised that instantiation expression syntax can be used in a type context. |
That's one of the chief purposes of instantiation expressions. For example, you can do |
We need to add this to the blog post |
Just going to throw out an overly-wishful idea that could maybe save the TS community a lot of effort when breaking syntax changes come out. What if:
|
To set expectations, I don't think we were even aware of the fact that this was a breaking change π. It's quite rare for this to happen. |
True, though something like that idea would also be really helpful for enabling |
We could consider requiring no line breaks between |
Note that requiring no line break is consistent with what TS already does in other cases (I was going to open an issue suggesting to require it to make ASI consistent, then I found this issue already opened!): // valid, a type alias followed by a JSX element
type A = b
<c></c> // this should be valid too
type A = typeof b
<c></c> |
I've sent #48755 which disallows the newline, unbreaking this. |
Bug Report
π Search Terms
typeof syntax missing semicolon generic
π Version & Regression Information
This changed between versions 4.6.2 and 4.7.0-beta
β― Playground Link
Playground link with relevant code
π» Code
This is a minimal repro, for a real-world example of a breakage, see https://raw.githubusercontent.com/pmndrs/react-spring/master/packages/types/interpolation.d.ts
π Actual behavior
Syntax errors:
π Expected behavior
No syntax errors
The text was updated successfully, but these errors were encountered: