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