-
Notifications
You must be signed in to change notification settings - Fork 29
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-expect-error before assignment from for expression #1135
Comments
This seems like the same issue as #1113. Could you move your example to there? |
I think it's different. That issue can plausibly be fixed by removing a newline from the generated code, and emitting |
Ah, right, sorry. |
Do you have a proposal for how to fix this? I don't think we can use One better workaround I think: sqrts := for i of [1..3]
Math.sqrt i
// @ts-expect-error I can't prove this has three elements but it does
t = sqrts It would be nice if this worked, but t = for i of [1..3]
Math.sqrt i
|> as [number, number, number] Or perhaps this would be even cleaner, but also doesn't parse as intended: t = for i of [1..3]
Math.sqrt i
as [number, number, number] Back to comments, one thing I would find somewhat natural to write is t = // @ts-expect-error
for i of [1..3]
Math.sqrt i Unfortunately |
In this code, it's impossible to place the
@ts-expect-error
directive correctly:The current spelling complains about the type mismatch and about an unused expect-error directive, as it compiles to
Current workaround:
The text was updated successfully, but these errors were encountered: