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
class Entry<T> {
constructor(callback: (v: T) => number) { }
}
interface Widget {
list: Entry<{ foo: number }>[];
}
var widget: Widget = {
list: [
new Entry((v) => v.foo), // Error accessing v.foo
]
};
We get a compiler error in the callback accessing v.foo that foo does not exist on type {} since {} is the default type when it is unable to infer the type. However, in this case we know from the Widget definition that T must be typed to {foo:number}. But, it appears TypeScript is not using this as an inference-site to properly determine T.