-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Missing completion list for single-statement lambda functions #1149
Comments
If the object literal is wrapped in parentheses, doesn't that mean that we elide contextual typing? I don't think this is a bug. |
From 4.19 in the spec:
|
Correct, in the first example you're writing a lambda with no curlies for the lambda body so we're interpreting the expression as the return value. But since your return value is parenthesized we don't contextually type it. If you remove the parentheses then the curlies become part of the lambda and you have to explicitly write the return statement which then is contextually typed. If you were to parenthesize that you'd see similar behavior, ex: var fooToo = function (): Foo {
return ({
b // no completion here since parenthesized expressions aren't contextually typed
});
} This is a good example of how this is all confusing though and doesn't really add any obvious value to the language, see #920 |
Hi,
VS: 2013 Update 4 RC
TS: 1.3
The completion list should be made available for the first case below:
The text was updated successfully, but these errors were encountered: