diff --git a/npm/ng-packs/packages/schematics/src/utils/enum.ts b/npm/ng-packs/packages/schematics/src/utils/enum.ts index c01b086ec5..5ff644db82 100644 --- a/npm/ng-packs/packages/schematics/src/utils/enum.ts +++ b/npm/ng-packs/packages/schematics/src/utils/enum.ts @@ -3,6 +3,7 @@ import { Exception } from '../enums'; import { Type } from '../models'; import { interpolate } from './common'; import { parseNamespace } from './namespace'; +import { isValidProp } from './prop'; export interface EnumGeneratorParams { targetPath: string; @@ -32,7 +33,10 @@ export function createImportRefToEnumMapper({ solution, types }: EnumGeneratorPa throw new SchematicsException(interpolate(Exception.NoTypeDefinition, ref)); const namespace = parseNamespace(solution, ref); - const members = enumNames!.map((key, i) => ({ key, value: enumValues[i] })); + const members = enumNames!.map((key, i) => ({ + key: isValidProp(key) ? key : `'${key}'`, + value: enumValues[i], + })); return { namespace,