I have declared the following enum in my Typescript file:
export const enum INPUT_PATTERNS{
ALL = ".*",
ONLY_NUMBERS = "[0-9]*"
}
During compilation, I keep on getting the following error message:
In 'const' enum declarations member initializer must be constant expression.
I have initialized the enums with constant values and so I dont understand whats wrong here?
Secondly, if I remove the const identifier from enum as follows:
export enum INPUT_PATTERNS{
ALL = ".*",
ONLY_NUMBERS = "[0-9]*"
}
then I get the following error:
Type '"."' is not assignable to type 'INPUT_PATTERNS'.
Type '"[0-9]"' is not assignable to type 'INPUT_PATTERNS'.