We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
TypeScript Version: nightly (2.2.0-dev.20161121 )
Code
function foo(): { x: number } { return { x: 1, y: 2 }; } async function bar(): Promise<{ x: number }> { return { x: 1, y: 2 }; }
Expected behavior:
Both are errors.
Actual behavior:
Only the first is an error.
The text was updated successfully, but these errors were encountered:
A third variant that currently gives no errors:
function baz(): Promise<{ x: number }> { return Promise.resolve({ x: 1, y: 2 }); }
That's semantically identical to bar. So if bar should be an error, what about baz?
bar
baz
Sorry, something went wrong.
the last one is not related. the last one is about using the return type as an inference location, see #11152
This one works OK today, so the issue could be closed :) cc @RyanCavanaugh
No branches or pull requests
TypeScript Version: nightly (2.2.0-dev.20161121 )
Code
Expected behavior:
Both are errors.
Actual behavior:
Only the first is an error.
The text was updated successfully, but these errors were encountered: