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: 3.1.0-dev.201xxxxx
Search Terms: function parameter type inference keyof generic Code
function foo1<T>(foo: T, bar: {[key in keyof {foo: number}] : (x: T) => number }) { } function foo2<T>(foo: T, bar: {[key in keyof T] : (x: T) => number }) { } foo1({foo: 1}, {foo: x1 => x1.foo + 1}) foo2({foo: 1}, {foo: x2 => x2.foo + 1})
Expected behavior: x2 has type {foo:number} Actual behavior: Compiler error TS7006: Parameter 'x2' implicitly has an 'any' type.
x2
{foo:number}
TS7006: Parameter 'x2' implicitly has an 'any' type.
x1 has type {foo:number} but x2 has type any
x1
any
Playground Link: Playground
The text was updated successfully, but these errors were encountered:
Is there any workaround?
Sorry, something went wrong.
This is fixed by #30568.
ahejlsberg
No branches or pull requests
TypeScript Version: 3.1.0-dev.201xxxxx
Search Terms:
function parameter type inference keyof generic
Code
Expected behavior:
x2
has type{foo:number}
Actual behavior:
Compiler error
TS7006: Parameter 'x2' implicitly has an 'any' type.
x1
has type{foo:number}
but
x2
has typeany
Playground Link:
Playground
The text was updated successfully, but these errors were encountered: