Skip to content

Instantly share code, notes, and snippets.

@jdpigeon
Created January 10, 2019 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdpigeon/95ded0fd60df2f527e93a9f8ed76f0b4 to your computer and use it in GitHub Desktop.
Save jdpigeon/95ded0fd60df2f527e93a9f8ed76f0b4 to your computer and use it in GitHub Desktop.
Typescript Class Enum Pattern
type BothOptions = 'raw_emg';
class Both {
public static RawEMG: Both = new Both('raw_emg');
private value: BothOptions;
private constructor(value: BothOptions) {
this.value = value;
}
public rawValue(): BothOptions {
return this.value;
}
public targetName(): string {
return this.value + "_target";
}
public batchTypeName(): string {
return this.value + "_batch";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment