Tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Julien Valverdé
2024-02-24 05:27:17 +01:00
parent 7da3d50bcc
commit 9a9b0edf5b

View File

@@ -59,20 +59,24 @@ class Box<T> {
return "prout" as const
}
method<
C extends typeof Box & Class<I>,
I extends Box<any>
newBox<
C extends Class<I, ConstructorParameters<typeof Box>>,
I extends Box<any>,
T,
>(
// this: Omit<BaseClass<T>, "constructor"> & { ["constructor"]: Class<I> }
this: { ["constructor"]: C }
this: { ["constructor"]: C | Class<I, ConstructorParameters<typeof Box>> },
value: T,
) {
// this.otherMethod()
return new this.constructor(69)
return new this.constructor(value)
}
}
class UnrelatedClass {}
class SuperBox<T> extends Box<T> {
declare ["constructor"]: typeof SuperBox
}
console.log(new Superclass().method())
const value = new SuperBox(69).newBox(69)