I'm looking for the correct way of returning the type of this from an implementation of an abstract method. Like the self in PHP.
I've tried this very basic example:
abstract class Listable {
public abstract list(): (typeof this)[]; //bad syntax
}
class SomeList extends Listable {
public list(): SomeList[] {
return [new SomeList, new SomeList, new SomeList];
}
}
This is - however - bad syntax. Is there a way to do this?