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
declareconstm: <TextendsM<T>>(m: T)=>TtypeM<Self,V=Prop<Self,"v">>={v: V,t?: (v: V)=>void}typeProp<T,K>=KextendskeyofT ? T[K] : "error"// expected : M<{ v: number, t?: (v: number) => void }>// actual : M<unknown>m({v: 1,t: k=>{}})// expected : M<{ v: number }>// actual : M<{ v: number }>m({v: 1})
π Actual behavior
In first function call of m, the parameter is inferred as M<unknown> in other words the TypeScript couldn't infer anything.
π Expected behavior
In first function call of m, the parameter should be inferred as M<{ v: number, t?: (v: number) => void }>. Especially given that removal of t works as seen in the second function call. Presence of a functional property shouldn't make the inference completely non-working.
The text was updated successfully, but these errors were encountered:
Bug Report
π Search Terms
Circular type parameter constraint, inference change due to presence of functional property
Related: #40439
π Version & Regression Information
Tested with v4.3.4
β― Playground Link
Playground
π» Code
π Actual behavior
In first function call of
m
, the parameter is inferred asM<unknown>
in other words the TypeScript couldn't infer anything.π Expected behavior
In first function call of
m
, the parameter should be inferred asM<{ v: number, t?: (v: number) => void }>
. Especially given that removal oft
works as seen in the second function call. Presence of a functional property shouldn't make the inference completely non-working.The text was updated successfully, but these errors were encountered: