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
interfaceProps<TSchema,TValue>{getter: (values: TSchema)=>TValue;worker: (value: TValue)=>void;}declarefunctionfn<TSchema,TValue>(props: Props<TSchema,TValue>): void;functionbindSchema<TSchema>(){returnfunctionboundFn<TValue>(props: Props<TSchema,TValue>){fn(props);};}constboundFn=bindSchema<{someValue: number}>();boundFn({getter: (values)=>values.someValue,worker: (value)=>{// value is unknown :(}});
π Actual behavior
value parameter type in worker method (line 18). is not inferred. value type is unknown.
π Expected behavior
value parameter type should be correctly inferred as number.
This code sample works fine, which is also surprising since the type for values parameter in getter method (line 17) is correctly inferred as { someValue: number } anyway:
boundFn({getter: (values: {someValue: number})=>values.someValue,worker: (value)=>{// value is number π }});
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
partial type argument inference, contextual typing
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
value
parameter type inworker
method (line 18). is not inferred.value
type isunknown
.π Expected behavior
value
parameter type should be correctly inferred asnumber
.This code sample works fine, which is also surprising since the type for
values
parameter ingetter
method (line 17) is correctly inferred as{ someValue: number }
anyway:The text was updated successfully, but these errors were encountered: