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