From 7da3d50bcc8dd173d8fc52d2c792643974728102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Valverd=C3=A9?= Date: Sat, 24 Feb 2024 04:10:01 +0100 Subject: [PATCH] Box tests --- src/tests.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/tests.ts b/src/tests.ts index 1d32cae..df65161 100644 --- a/src/tests.ts +++ b/src/tests.ts @@ -51,25 +51,28 @@ const subInst = await SubTest.createPromise({ name: "", prout: "" }) // console.log(subInst) -class BaseClass { - declare ["constructor"]: typeof BaseClass - - static readonly issou = "gneugneu" +class Box { + declare ["constructor"]: typeof Box + constructor(public value: T) {} otherMethod() { return "prout" as const } - method( - this: Omit & { ["constructor"]: Class } + method< + C extends typeof Box & Class, + I extends Box + >( + // this: Omit, "constructor"> & { ["constructor"]: Class } + this: { ["constructor"]: C } ) { - this.otherMethod() - return new this.constructor() + // this.otherMethod() + return new this.constructor(69) } } -class Superclass extends BaseClass { - declare ["constructor"]: typeof Superclass +class SuperBox extends Box { + declare ["constructor"]: typeof SuperBox } console.log(new Superclass().method())