You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Search Terms: arrow function method object literal
Code
typeTest<Kextendskeyofany>={[PinK|"foo"]: Pextends"foo" ? true : ()=>any}functiontest<TextendsTest<keyofT>>(arg: T){returnarg;}constres1=test({foo: true,bar(){// Notice the type param of `test` is inferred as `Test<never>`}})constres2=test({foo: true,bar: function(){// Same error here.}})constres3=test({foo: true,bar: ()=>{// This is fine.}})
Expected behavior: The first two test calls should infer the given object type correctly.
Actual behavior: They instead infer the object type as Test<never>. 😢
TypeScript Version: 3.2.2 and 3.3.0-dev.20190119
Search Terms: arrow function method object literal
Code
Expected behavior: The first two
test
calls should infer the given object type correctly.Actual behavior: They instead infer the object type as
Test<never>
. 😢Playground Link: Click here
Related Issues: #17867 (sort of)
The text was updated successfully, but these errors were encountered: