0.1.2 #3

Merged
Thilawyn merged 136 commits from next into master 2024-03-11 19:44:21 +01:00
Showing only changes of commit 9a9b0edf5b - Show all commits

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)