This commit is contained in:
23
src/tests.ts
23
src/tests.ts
@@ -51,25 +51,28 @@ const subInst = await SubTest.createPromise({ name: "", prout: "" })
|
|||||||
// console.log(subInst)
|
// console.log(subInst)
|
||||||
|
|
||||||
|
|
||||||
class BaseClass {
|
class Box<T> {
|
||||||
declare ["constructor"]: typeof BaseClass
|
declare ["constructor"]: typeof Box
|
||||||
|
constructor(public value: T) {}
|
||||||
static readonly issou = "gneugneu"
|
|
||||||
|
|
||||||
otherMethod() {
|
otherMethod() {
|
||||||
return "prout" as const
|
return "prout" as const
|
||||||
}
|
}
|
||||||
|
|
||||||
method<I extends object>(
|
method<
|
||||||
this: Omit<BaseClass, "constructor"> & { ["constructor"]: Class<I> }
|
C extends typeof Box & Class<I>,
|
||||||
|
I extends Box<any>
|
||||||
|
>(
|
||||||
|
// this: Omit<BaseClass<T>, "constructor"> & { ["constructor"]: Class<I> }
|
||||||
|
this: { ["constructor"]: C }
|
||||||
) {
|
) {
|
||||||
this.otherMethod()
|
// this.otherMethod()
|
||||||
return new this.constructor()
|
return new this.constructor(69)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Superclass extends BaseClass {
|
class SuperBox<T> extends Box<T> {
|
||||||
declare ["constructor"]: typeof Superclass
|
declare ["constructor"]: typeof SuperBox
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(new Superclass().method())
|
console.log(new Superclass().method())
|
||||||
|
|||||||
Reference in New Issue
Block a user