I have placed an enum in a seperate file so I can use that enum across files
Enums.ts
export enum Category {
NotDefined,
BackData,
Testing,
Simulated
}
In another file i try to use my enum. I am trying to write a simple if/else or switch.
If i set the value of category == Category.Testing vscode is happy. If i try to set the value to something else e.g. "backData" as in the example below I get an error:
Type 'Category.Testing' is not comparable to type 'Category.BackData'
Example code:
import { Category } from '@app/model/Enums.ts';
public async SubmitForm(): Promise<Boolean> {
var category: Category;
category = Category.BackData;
switch (category) {
case (Category.Testing): {
...
}
default: {
...
}
}
if (category == Category.Testing) {
...
} else {
...
}
}
The error when setting the enum to another value that testing
