Description
When using @hey-api/openapi-ts with the @hey-api/client-fetch plugin, the generated file src/client/core/params.gen.ts fails TypeScript typechecking when stableTypeOrdering is enabled.
The failing generated line is:
params[field.map] = value;
In my repro, this becomes:
src/client/core/params.gen.ts(145,13): error TS2322: Type 'unknown' is not assignable to type 'Record<string, unknown>'.
The same generated output typechecks successfully when stableTypeOrdering is disabled.
This makes migration to TS 7.0 impossible
Reproducible example or configuration
Minimal repro repo:
Local repro commands:
pnpm install
pnpm run generate
pnpm run typecheck:without-stable
pnpm run typecheck
Observed behavior:
pnpm run typecheck:without-stable passes
pnpm run typecheck fails in generated src/client/core/params.gen.ts
Relevant config:
export default {
input: './openapi.json',
output: 'src/client',
plugins: ['@hey-api/typescript', '@hey-api/sdk', '@hey-api/client-fetch'],
};
{
"compilerOptions": {
"strict": true,
"noEmit": true,
"skipLibCheck": true,
"stableTypeOrdering": true,
"module": "ESNext",
"moduleResolution": "Bundler",
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"]
},
"include": ["src/**/*.ts"]
}
OpenAPI specification (optional)
The repro repo includes a minimal openapi.json that is enough to make openapi-ts emit the failing params.gen.ts helper.
System information (optional)
@hey-api/openapi-ts: 0.97.1
typescript: 6.0.3
pnpm: 10.17.1
- OS: macOS
Additional context
This looks like a generator typing issue in the shared client-fetch helper template rather than an application-specific problem, because the failure is isolated to generated code
Description
When using
@hey-api/openapi-tswith the@hey-api/client-fetchplugin, the generated filesrc/client/core/params.gen.tsfails TypeScript typechecking whenstableTypeOrderingis enabled.The failing generated line is:
In my repro, this becomes:
The same generated output typechecks successfully when
stableTypeOrderingis disabled.This makes migration to TS 7.0 impossible
Reproducible example or configuration
Minimal repro repo:
Local repro commands:
Observed behavior:
pnpm run typecheck:without-stablepassespnpm run typecheckfails in generatedsrc/client/core/params.gen.tsRelevant config:
{ "compilerOptions": { "strict": true, "noEmit": true, "skipLibCheck": true, "stableTypeOrdering": true, "module": "ESNext", "moduleResolution": "Bundler", "target": "ES2022", "lib": ["ES2022", "DOM", "DOM.Iterable"] }, "include": ["src/**/*.ts"] }OpenAPI specification (optional)
The repro repo includes a minimal
openapi.jsonthat is enough to makeopenapi-tsemit the failingparams.gen.tshelper.System information (optional)
@hey-api/openapi-ts:0.97.1typescript:6.0.3pnpm:10.17.1Additional context
This looks like a generator typing issue in the shared
client-fetchhelper template rather than an application-specific problem, because the failure is isolated to generated code