I defined a service package for my angular app, where it has string enum definitions:
export enum CloudTypeEnum {
AZURE = 'AZURE',
AMAZON = 'AMAZON',
GOOGLE = 'GOOGLE',
}
In the tsconfig.json, I define the package path, where it exports the string enum:
"paths": {
"@cloud-services/*": ["packages/service/*"],
}
When trying to use it in the angular service
import {CloudTypeEnum} from '@cloud-service';
isAzureCloud(type: CloudTypeEnum):boolean {
return type == CloudTypeEnum.AZURE;
}
I found that the CloudTypeEnum is not a object but a module in the chrome inspector.
While the enum defined in the service is a object. So I am not sure why typescript compile my enum to module, which may lead if check always return false.