Default export of the module has or is using private name 'ClientConfig'.
Description
When following the documentation I get a type error with the following code block:
import { defineConfig } from '@hey-api/openapi-ts';
export default defineConfig({
input: 'path/to/openapi.json',
output: 'src/client',
});
Default export of the module has or is using private name 'ClientConfig'.
It seems that only the type UserConfig is exported, however because type UserConfig = ClientConfig; the type ClientConfig is expected and this is a private interface.
OpenAPI specification (optional)
No response
Configuration
No response
System information (optional)
tsconfig
"compilerOptions": {
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"strict": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2015",
"module": "esnext",
"lib": ["es2020", "dom"],
"skipLibCheck": true,
"skipDefaultLibCheck": true,
"baseUrl": "."
}
typescript: 5.3.3
Which package versions is this @alainfonhof?
0.46.3
@alainfonhof Are you able to create a StackBlitz example with reproducible project?
In this https://stackblitz.com/edit/hey-api-example go to the file tsconfig.node.json and remove the line "include": ["vite.config.ts"]. Now in openapi-ts.config.ts, there is the error.
~It seems related to the composite option, since if I remove it the error goes away.~ Well, no, because then the tsconfig.json gives an error
Removing "references": [{ "path": "./tsconfig.node.json" }] from the tsconfig.json and also removing tsconfig.node.json fixed it for me.
Removing composite: true from tsconfig.json fixed this issue for me as well. It seems like this might represent a different issue of being incompatible with multiple tsconfig files?
inside the index.d.ts file from the hey-api package removed the error for me. I guess it will come back when / if the package is updated, or the repo is shared with someone else. But it was a quick fix for now :)
export interface ClientConfig { ...
Changing ClientConfig from an interface to a type worked for this case https://github.com/storybookjs/storybook/issues/12064#issuecomment-1488872947 (so the type isn't exposed), but now it give the following errors
Default export of the module has or is using private name 'PluginTanStackReactQuery'.ts(4082)
Default export of the module has or is using private name 'PluginTanStackSolidQuery'.ts(4082)
Default export of the module has or is using private name 'PluginTanStackSvelteQuery'.ts(4082)
Default export of the module has or is using private name 'PluginTanStackVueQuery'.ts(4082)
So maybe it not related to openapi-ts?
Edit: environment is downloaded code from StackBlitz npm linked to local hey-api/open-api repo
Ya it looks like a TypeScript issue https://github.com/Microsoft/TypeScript/issues/23280#issuecomment-379859847
Edit: That is the cause of the bug is UserConfig type aliases the interface ClientConfig https://github.com/hey-api/openapi-ts/blob/7e84960713160fc942c6e5a109e7d9687fb9dafc/packages/openapi-ts/src/types/config.ts#L237 This seems to be an unresolved issue