diff --git a/src/tests.ts b/src/tests.ts index df65161..9471198 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -59,20 +59,24 @@ class Box { return "prout" as const } - method< - C extends typeof Box & Class, - I extends Box + newBox< + C extends Class>, + I extends Box, + T, >( // this: Omit, "constructor"> & { ["constructor"]: Class } - this: { ["constructor"]: C } + this: { ["constructor"]: C | Class> }, + value: T, ) { // this.otherMethod() - return new this.constructor(69) + return new this.constructor(value) } } +class UnrelatedClass {} + class SuperBox extends Box { declare ["constructor"]: typeof SuperBox } -console.log(new Superclass().method()) +const value = new SuperBox(69).newBox(69)