diff --git a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache index 20f21ef5c9f1..5bab7a5a98c2 100644 --- a/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-fetch/modelEnum.mustache @@ -3,7 +3,7 @@ export function instanceOf{{classname}}(value: any): boolean { for (const key in {{classname}}) { if (Object.prototype.hasOwnProperty.call({{classname}}, key)) { - if (({{classname}} as Record)[key] === value) { + if ({{classname}}[key as keyof typeof {{classname}}] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts index 3233ca6c9494..c58c82e92569 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/EnumClass.ts @@ -28,7 +28,7 @@ export type EnumClass = typeof EnumClass[keyof typeof EnumClass]; export function instanceOfEnumClass(value: any): boolean { for (const key in EnumClass) { if (Object.prototype.hasOwnProperty.call(EnumClass, key)) { - if ((EnumClass as Record)[key] === value) { + if (EnumClass[key as keyof typeof EnumClass] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts index b4427d5dad3d..2c304d574003 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnum.ts @@ -28,7 +28,7 @@ export type OuterEnum = typeof OuterEnum[keyof typeof OuterEnum]; export function instanceOfOuterEnum(value: any): boolean { for (const key in OuterEnum) { if (Object.prototype.hasOwnProperty.call(OuterEnum, key)) { - if ((OuterEnum as Record)[key] === value) { + if (OuterEnum[key as keyof typeof OuterEnum] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts index 5c44e1853716..c5aabe1ad685 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumDefaultValue.ts @@ -28,7 +28,7 @@ export type OuterEnumDefaultValue = typeof OuterEnumDefaultValue[keyof typeof Ou export function instanceOfOuterEnumDefaultValue(value: any): boolean { for (const key in OuterEnumDefaultValue) { if (Object.prototype.hasOwnProperty.call(OuterEnumDefaultValue, key)) { - if ((OuterEnumDefaultValue as Record)[key] === value) { + if (OuterEnumDefaultValue[key as keyof typeof OuterEnumDefaultValue] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts index 33609e9b0f3d..cb5a0a251509 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumInteger.ts @@ -28,7 +28,7 @@ export type OuterEnumInteger = typeof OuterEnumInteger[keyof typeof OuterEnumInt export function instanceOfOuterEnumInteger(value: any): boolean { for (const key in OuterEnumInteger) { if (Object.prototype.hasOwnProperty.call(OuterEnumInteger, key)) { - if ((OuterEnumInteger as Record)[key] === value) { + if (OuterEnumInteger[key as keyof typeof OuterEnumInteger] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts index 08927e2f8f80..1e9b73ce4956 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/OuterEnumIntegerDefaultValue.ts @@ -28,7 +28,7 @@ export type OuterEnumIntegerDefaultValue = typeof OuterEnumIntegerDefaultValue[k export function instanceOfOuterEnumIntegerDefaultValue(value: any): boolean { for (const key in OuterEnumIntegerDefaultValue) { if (Object.prototype.hasOwnProperty.call(OuterEnumIntegerDefaultValue, key)) { - if ((OuterEnumIntegerDefaultValue as Record)[key] === value) { + if (OuterEnumIntegerDefaultValue[key as keyof typeof OuterEnumIntegerDefaultValue] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts index 8daaecf3c495..260be835d982 100644 --- a/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts +++ b/samples/client/petstore/typescript-fetch/builds/default-v3.0/models/SingleRefType.ts @@ -27,7 +27,7 @@ export type SingleRefType = typeof SingleRefType[keyof typeof SingleRefType]; export function instanceOfSingleRefType(value: any): boolean { for (const key in SingleRefType) { if (Object.prototype.hasOwnProperty.call(SingleRefType, key)) { - if ((SingleRefType as Record)[key] === value) { + if (SingleRefType[key as keyof typeof SingleRefType] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts index 225a39078447..1684281cc9ad 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/NumberEnum.ts @@ -28,7 +28,7 @@ export type NumberEnum = typeof NumberEnum[keyof typeof NumberEnum]; export function instanceOfNumberEnum(value: any): boolean { for (const key in NumberEnum) { if (Object.prototype.hasOwnProperty.call(NumberEnum, key)) { - if ((NumberEnum as Record)[key] === value) { + if (NumberEnum[key as keyof typeof NumberEnum] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts b/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts index 1f7477bf1687..1b1a1f1e5ae8 100644 --- a/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/enum/models/StringEnum.ts @@ -28,7 +28,7 @@ export type StringEnum = typeof StringEnum[keyof typeof StringEnum]; export function instanceOfStringEnum(value: any): boolean { for (const key in StringEnum) { if (Object.prototype.hasOwnProperty.call(StringEnum, key)) { - if ((StringEnum as Record)[key] === value) { + if (StringEnum[key as keyof typeof StringEnum] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts index a16d3f8c2656..6792815d839d 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/BehaviorType.ts @@ -28,7 +28,7 @@ export type BehaviorType = typeof BehaviorType[keyof typeof BehaviorType]; export function instanceOfBehaviorType(value: any): boolean { for (const key in BehaviorType) { if (Object.prototype.hasOwnProperty.call(BehaviorType, key)) { - if ((BehaviorType as Record)[key] === value) { + if (BehaviorType[key as keyof typeof BehaviorType] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts index 0a84d2dce814..5ae82e7f2ef4 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/DeploymentRequestStatus.ts @@ -37,7 +37,7 @@ export type DeploymentRequestStatus = typeof DeploymentRequestStatus[keyof typeo export function instanceOfDeploymentRequestStatus(value: any): boolean { for (const key in DeploymentRequestStatus) { if (Object.prototype.hasOwnProperty.call(DeploymentRequestStatus, key)) { - if ((DeploymentRequestStatus as Record)[key] === value) { + if (DeploymentRequestStatus[key as keyof typeof DeploymentRequestStatus] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts index 669c957006c3..7b85047567d8 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/ErrorCode.ts @@ -43,7 +43,7 @@ export type ErrorCode = typeof ErrorCode[keyof typeof ErrorCode]; export function instanceOfErrorCode(value: any): boolean { for (const key in ErrorCode) { if (Object.prototype.hasOwnProperty.call(ErrorCode, key)) { - if ((ErrorCode as Record)[key] === value) { + if (ErrorCode[key as keyof typeof ErrorCode] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts index d03752c43ddd..0529649ea2df 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/PetPartType.ts @@ -28,7 +28,7 @@ export type PetPartType = typeof PetPartType[keyof typeof PetPartType]; export function instanceOfPetPartType(value: any): boolean { for (const key in PetPartType) { if (Object.prototype.hasOwnProperty.call(PetPartType, key)) { - if ((PetPartType as Record)[key] === value) { + if (PetPartType[key as keyof typeof PetPartType] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts index 3d73bec13539..2ebc7a17f0a1 100644 --- a/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts +++ b/samples/client/petstore/typescript-fetch/builds/sagas-and-records/src/models/WarningCode.ts @@ -28,7 +28,7 @@ export type WarningCode = typeof WarningCode[keyof typeof WarningCode]; export function instanceOfWarningCode(value: any): boolean { for (const key in WarningCode) { if (Object.prototype.hasOwnProperty.call(WarningCode, key)) { - if ((WarningCode as Record)[key] === value) { + if (WarningCode[key as keyof typeof WarningCode] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts index 3233ca6c9494..c58c82e92569 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/EnumClass.ts @@ -28,7 +28,7 @@ export type EnumClass = typeof EnumClass[keyof typeof EnumClass]; export function instanceOfEnumClass(value: any): boolean { for (const key in EnumClass) { if (Object.prototype.hasOwnProperty.call(EnumClass, key)) { - if ((EnumClass as Record)[key] === value) { + if (EnumClass[key as keyof typeof EnumClass] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts index b4427d5dad3d..2c304d574003 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnum.ts @@ -28,7 +28,7 @@ export type OuterEnum = typeof OuterEnum[keyof typeof OuterEnum]; export function instanceOfOuterEnum(value: any): boolean { for (const key in OuterEnum) { if (Object.prototype.hasOwnProperty.call(OuterEnum, key)) { - if ((OuterEnum as Record)[key] === value) { + if (OuterEnum[key as keyof typeof OuterEnum] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts index 5c44e1853716..c5aabe1ad685 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumDefaultValue.ts @@ -28,7 +28,7 @@ export type OuterEnumDefaultValue = typeof OuterEnumDefaultValue[keyof typeof Ou export function instanceOfOuterEnumDefaultValue(value: any): boolean { for (const key in OuterEnumDefaultValue) { if (Object.prototype.hasOwnProperty.call(OuterEnumDefaultValue, key)) { - if ((OuterEnumDefaultValue as Record)[key] === value) { + if (OuterEnumDefaultValue[key as keyof typeof OuterEnumDefaultValue] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts index 33609e9b0f3d..cb5a0a251509 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumInteger.ts @@ -28,7 +28,7 @@ export type OuterEnumInteger = typeof OuterEnumInteger[keyof typeof OuterEnumInt export function instanceOfOuterEnumInteger(value: any): boolean { for (const key in OuterEnumInteger) { if (Object.prototype.hasOwnProperty.call(OuterEnumInteger, key)) { - if ((OuterEnumInteger as Record)[key] === value) { + if (OuterEnumInteger[key as keyof typeof OuterEnumInteger] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts index 08927e2f8f80..1e9b73ce4956 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/OuterEnumIntegerDefaultValue.ts @@ -28,7 +28,7 @@ export type OuterEnumIntegerDefaultValue = typeof OuterEnumIntegerDefaultValue[k export function instanceOfOuterEnumIntegerDefaultValue(value: any): boolean { for (const key in OuterEnumIntegerDefaultValue) { if (Object.prototype.hasOwnProperty.call(OuterEnumIntegerDefaultValue, key)) { - if ((OuterEnumIntegerDefaultValue as Record)[key] === value) { + if (OuterEnumIntegerDefaultValue[key as keyof typeof OuterEnumIntegerDefaultValue] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts index 8daaecf3c495..260be835d982 100644 --- a/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts +++ b/samples/client/petstore/typescript-fetch/builds/snakecase-discriminator/models/SingleRefType.ts @@ -27,7 +27,7 @@ export type SingleRefType = typeof SingleRefType[keyof typeof SingleRefType]; export function instanceOfSingleRefType(value: any): boolean { for (const key in SingleRefType) { if (Object.prototype.hasOwnProperty.call(SingleRefType, key)) { - if ((SingleRefType as Record)[key] === value) { + if (SingleRefType[key as keyof typeof SingleRefType] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts index 18a96213d14d..2181967c9a69 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/NumberEnum.ts @@ -27,7 +27,7 @@ export enum NumberEnum { export function instanceOfNumberEnum(value: any): boolean { for (const key in NumberEnum) { if (Object.prototype.hasOwnProperty.call(NumberEnum, key)) { - if ((NumberEnum as Record)[key] === value) { + if (NumberEnum[key as keyof typeof NumberEnum] === value) { return true; } } diff --git a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts index 43acb9cc477b..bcb11c3d400b 100644 --- a/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts +++ b/samples/client/petstore/typescript-fetch/builds/with-string-enums/models/StringEnum.ts @@ -27,7 +27,7 @@ export enum StringEnum { export function instanceOfStringEnum(value: any): boolean { for (const key in StringEnum) { if (Object.prototype.hasOwnProperty.call(StringEnum, key)) { - if ((StringEnum as Record)[key] === value) { + if (StringEnum[key as keyof typeof StringEnum] === value) { return true; } }