How to override static variables from inherited derived classes in typescript
I managed to get the static like this:
(<typeof SqlModel> this.constructor).tableName
You can use this.tableName
:
class SqlModel {
protected static tableName: string;
public static outputTableName() {
console.log(this.tableName);
}
}
class User extends SqlModel {
protected static tableName = 'User';
}
User.outputTableName(); // outputs "User"