I have many class with their static variables, like this:
user.ts:
export class User {
static modelKey = 'user';
// other variables
}
car.ts:
export class Car {
static modelKey = 'car';
// other variables
}
And somewhere I want just call the DataSource (see below) like this:
const dataSource = new DataSource<Car>();
data-source.ts:
export class DataSource<T> {
constructor() {
console.log(T.modelKey); // won't compile
}
}
Of course, it won't compile because I can't simple use T.<variable>. So, my question is: how can I accomplish this?