Skip to content

Instantly share code, notes, and snippets.

@Armenvardanyan95
Created May 27, 2020 09:02
Show Gist options
  • Save Armenvardanyan95/7d1adf473a0846faf27a54652e829bb8 to your computer and use it in GitHub Desktop.
Save Armenvardanyan95/7d1adf473a0846faf27a54652e829bb8 to your computer and use it in GitHub Desktop.
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