Q:

How to get values of enum in typescript

I have a problem with getting values from enum. Here is the snippet of my code:
export const enum ComplianceType {
  ENGINEER_ASSESMENT = 'ENGINEER_ASSESMENT',
  CONSTRUCTION_COMPLIANCE = 'CONSTRUCTION_COMPLIANCE',
  ARCHITECTURE_ASSIGNMENT = 'ARCHITECTURE_ASSIGNMENT',
  BLUEPRINT_APPROVAL = 'BLUEPRINT_APPROVAL',
  THERMAL_COMPLIANCE = 'THERMAL_COMPLIANCE',
  ELECTRICITY_COMPLIANCE = 'ELECTRICITY_COMPLIANCE',
  TELECOMUNICATION_COMPLIANCE = 'TELECOMUNICATION_COMPLIANCE',
  WATER_COMPLIANCE = 'WATER_COMPLIANCE',
  OTHER_1 = 'OTHER_1',
  OTHER_2 = 'OTHER_2',
}

in my .ts file:
import { ICompliance, ComplianceType } from 'app/shared/model/compliance.model';

And i tried this one: 
complianceTypeList: ComplianceType;

I don't get how to get values from enum in typescript. Any advice ?

A:

Your syntax is wrong. 
You should not assign it, or try to assign Enums as variables. Just export enum ComplianceType will do.
export enum ComplianceType {
  ENGINEER_ASSESMENT = 'ENGINEER_ASSESMENT',
  CONSTRUCTION_COMPLIANCE = 'CONSTRUCTION_COMPLIANCE',
  ARCHITECTURE_ASSIGNMENT = 'ARCHITECTURE_ASSIGNMENT',
  BLUEPRINT_APPROVAL = 'BLUEPRINT_APPROVAL',
  THERMAL_COMPLIANCE = 'THERMAL_COMPLIANCE',
  ELECTRICITY_COMPLIANCE = 'ELECTRICITY_COMPLIANCE',
  TELECOMUNICATION_COMPLIANCE = 'TELECOMUNICATION_COMPLIANCE',
  WATER_COMPLIANCE = 'WATER_COMPLIANCE',
  OTHER_1 = 'OTHER_1',
  OTHER_2 = 'OTHER_2',
}

From there, you can simply import the Enums on the Class, or component, that requires it.
import { ComplianceType } from 'app/shared/model/compliance.model';

Works perfectly fine over here.

