openapi-ts
openapi-ts copied to clipboard
Typescript Issue Since 0.65.0
Description
Everything was working OK for me in 0.64.15, but since 0.65.0 (currently 0.66.3), I'm getting a typescript error, and it seems to be in the library's typings file (\node_modules@hey-api\openapi-ts\dist\index.d.ts) rather than my config file.
node_modules/@hey-api/openapi-ts/dist/index.d.ts(6471,32): error TS2344: Type 'Omit<Config, "name">' does not satisfy the constraint 'BaseConfig'.
Property 'name' is missing in type 'Omit<Config, "name">' but required in type 'BaseConfig'.
node_modules/@hey-api/openapi-ts/dist/index.d.ts(6542,3): error TS2344: Type 'Omit<Config$k | Config$j | Config$i | Config$h, "name">' does not satisfy the constraint 'BaseConfig'.
Property 'name' is missing in type 'Omit<Config$k | Config$j | Config$i | Config$h, "name">' but required in type 'BaseConfig'.
My config file is named openapi-ts.config.mts.
Reproducible example or configuration
import { defineConfig } from "@hey-api/openapi-ts";
export default defineConfig({
input: "./openapi/swagger-design.json",
output: {
path: "./openapi-gen",
lint: "eslint"
},
name: "GlacierDesignApi",
plugins: [
{
name: "legacy/fetch"
},
{
name: "@hey-api/schemas"
},
{
name: "@hey-api/sdk",
asClass: true
},
{
name: "@hey-api/typescript",
enums: "javascript",
exportInlineEnums: true
}
]
});
OpenAPI specification (optional)
No response
System information (optional)
No response
@bdbvb Have you updated all @hey-api/* packages to the latest and re-run the codegen?
@bdbvb Have you updated all
@hey-api/*packages to the latest and re-run the codegen?
Yes, on version 0.66.3.
Ah, I see. It could be related to the legacy client, I'm not sure if it was updated to match the latest, probably not. I'd recommend staying on the last version that builds, unless there's a specific feature you wanted to use by upgrading?
@mrlubos
I finally got around to updating to the non-legacy client
"@hey-api/client-fetch": "0.10.1",
"@hey-api/openapi-ts": "0.67.5",
and I'm still encountering this error:
node_modules/@hey-api/openapi-ts/dist/types.d-Bo4RQoDC.d.ts(6471,32): error TS2344: Type 'Omit<Config, "name">' does not satisfy the constraint 'BaseConfig'.
Property 'name' is missing in type 'Omit<Config, "name">' but required in type 'BaseConfig'.
node_modules/@hey-api/openapi-ts/dist/types.d-Bo4RQoDC.d.ts(6542,3): error TS2344: Type 'Omit<Config$k | Config$j | Config$i | Config$h, "name">' does not satisfy the constraint 'BaseConfig'.
Property 'name' is missing in type 'Omit<Config$k | Config$j | Config$i | Config$h, "name">' but required in type 'BaseConfig'.
My config file currently looks like so:
import { defineConfig } from "@hey-api/openapi-ts";
export default defineConfig({
input: "./openapi/swagger-design.json",
output: {
path: "./openapi-gen",
lint: "eslint"
},
name: "GlacierDesignApi",
plugins: [
{
name: "@hey-api/client-fetch",
throwOnError: true
},
{
name: "@hey-api/schemas"
},
{
name: "@hey-api/sdk",
asClass: true
},
{
name: "@hey-api/typescript",
enums: "javascript",
exportInlineEnums: true,
readOnlyWriteOnlyBehavior: "off"
}
]
});
I'm using
import { createClient, Client } from '@hey-api/client-fetch';
...
... createClient({ baseUrl, auth });
~~any thoughts on how to get around this so I'm able to stay up with latest versions?~~
update: "skipLibCheck": true in tsconfig.json gets rid of the error. not sure if everything is kosher with that, but it unsticks me.
I guess the typings still probably need to be fixed.
Thanks much!