Closed
Description
TypeScript Version: 2.3.2
Code
I have this definition:
extend<T, K>(cls: (...args: {}[]) => T, xtn: K): new (...args: {}[]) => T & K
Usage:
var NewClass = extend(MyClass, {
init(a) {
this.doSomething();
},
// ....
})
The NewClass
will still have all expected method init
..., but the this
cannot be inferred inside the extension object.
It would be great if there is a way to instruct Typescript how to infer the this
inside extension object based on the first passed param meter. (MyClass
in the example). The reason is to have better intellisense.