-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Union returntype with void must return a value #6326
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
Comments
Proposing changing spec section 6.3
to
|
That still doesn't actually cover |
Not sure I understand the comment |
The change you're proposing doesn't permit an async function whose return type annotation is |
I don't think anyone would want that behavior (@Pajn, care to weigh in?) |
It would be nice if Promise didn't require a return statement in an async function. However for the issue I had the already proposed change would be enough. |
Approved, accepting PRs. Should be easy. |
@RyanCavanaugh Regarding:
Isn't the emphasized part redundant? The following already compiles:
I think the union resolution already recognizes that all types are subtypes of |
I think that's an implementation side effect of the compiler. The spec doesn't specify that |
I have a method declared as
stop(): void|Promise<void> {}
which get the errorAs void is a valid return type I would expect that to be fully valid code. Specifying only void is working.
The text was updated successfully, but these errors were encountered: