-
-
Save interfacekun/3abd8119a62366a24c12083e1819453e to your computer and use it in GitHub Desktop.
Clz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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