Created
May 27, 2020 09:02
-
-
Save Armenvardanyan95/7d1adf473a0846faf27a54652e829bb8 to your computer and use it in GitHub Desktop.
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
class ActionNames { | |
private static names = new Set<string>(); | |
static create(name: string): string { | |
if (ActionNames.names.has(name)) { | |
throw new Error('An Action with this type already exists!'); | |
} | |
ActionNames.names.add(name); | |
return name; | |
} | |
} | |
const someAction = createAction(ActionNames.create('[Page] Actions Name')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment