When a schema property has both enum and const fields, and the schema contains only properties
with const values, orval generates incorrect TypeScript code with two issues:
- Wrong import statement: Uses
import type instead of import for enum constants used as
values
- Type/value space confusion: References enum type name as a value in const object
import type { AType } from './aType';
export const AValue = {
type: AType, // 'AType' cannot be used as a value because it was imported using 'import type'.
} as const;
export type A = typeof AValue;
Reproduction
See minimal reproduction example: https://github.com/ioslh/temp-orval-generate
You can clone the repo and run npm run generate to see the generated result.