TypeScript/tests/cases/compiler/subclassWithPolymorphicThisIsAssignable.ts
Wesley Wigham 02fe840732
Get constraint with this argument of the type parameter for comparisons (#21210)
* Get constraint with this argument of the type parameter for comparisons

* Also instantiate indexed accesses

* Add much simpler test
2018-05-18 18:30:23 -07:00

17 lines
389 B
TypeScript

/* taken from mongoose.Document */
interface Document {
increment(): this;
}
/* our custom model extends the mongoose document */
interface CustomDocument extends Document { }
export class Example<Z extends CustomDocument> {
constructor() {
// types of increment not compatible??
this.test<Z>();
}
public test<Z extends Document>() { }
}