From 9a9b0edf5bce5295de6c4c28324e8fa89405a15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 24 Feb 2024 05:27:17 +0100 Subject: [PATCH] Tests --- src/tests.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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)