In javascript I can create methods dinamically inside a class, like so:
const methods = ['error', 'info', 'warning', 'debug'];
class Logger {
constructor() {
this.name = 'log';
for (const method of methods) {
this[method] = () => {
console.log(method);
};
}
}
}
Is it possible to do the same but in TypeScript?