I have the following enum:
export enum ContentState {
unstable = 'UNSTABLE',
draft = 'DRAFT',
stable = 'STABLE',
}
I want to check if a given enum
within my program is STABLE
. I want something like
data.myState.isStable()
and the check is done like this===ContentState.stable
. I know I can do it within the code but I would be curious if I could spice up the enums.
I thought if I use as well
export namespace ContentState {
const isReleasedStatus = (state: ContentState) => state === ContentState.STABLE;
}
but than I need to bypass the enum by itself. PLUS it is not imported into another class.