Skip to content

Instantly share code, notes, and snippets.

@interfacekun
Created November 24, 2020 06:09
Show Gist options
  • Save interfacekun/3abd8119a62366a24c12083e1819453e to your computer and use it in GitHub Desktop.
Save interfacekun/3abd8119a62366a24c12083e1819453e to your computer and use it in GitHub Desktop.
Clz
enum ClzEnum {
A = 'clzA',
B = 'clzB',
C = 'clzC'
}
abstract class ClzBase {
constructor() {
}
}
class ClzA extends ClzBase {
constructor() {
super();
}
public a() {
}
}
class ClzB extends ClzBase {
constructor() {
super();
}
public b() {
}
}
class ClzC extends ClzBase {
constructor() {
super();
}
public c() {
}
}
type ClzLut = {
[ClzEnum.A]: typeof ClzA,
[ClzEnum.B]: typeof ClzB,
[ClzEnum.C]: typeof ClzC
};
const ClzConstructorLut: ClzLut = {
[ClzEnum.A]: ClzA,
[ClzEnum.B]: ClzB,
[ClzEnum.C]: ClzC
};
new ClzConstructorLut[ClzEnum.A]();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment