-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add enums.gen to index.ts #396
Comments
Yeah shouldn't be a problem to add enums to index. Though the intent is to remove all re-exported modules and you'd be importing each layer as needed (types, services, enums, schemas) https://heyapi.vercel.app/openapi-ts/migrating.html#deprecated-exports-from-index-ts |
Ah, hadn't seen that page yet. If the goal is to remove them from index.ts, then I understand. Personally I don't like the new naming scheme (.gen.ts) for the files as the import would look like: import type { Model } from 'client/models.gen';
import { Enum } from 'client/enums.gen';
import { $Schema } from 'client/schemas.gen';
import { DefaultService } from 'client/services.gen'; Maybe it's an idea to give index.ts a new name, so people can create the index.ts file themself. |
We could do that. This pattern is inspired by TanStack Router with the goal of reducing confusion around which files are generated. It might be easier to migrate if we provide a backward compatible setting though, good suggestion |
@mrlubos NOTE: if we remove the 'Enum' Suffix from generated enums there may be conflicts between the types generate and the enums. Making it cause issues exporting both in the index.ts |
I have only re-exported enums from index file for now, don't want to introduce complexity around transforming names right now. Will give it a while, see if you still hate it |
@mlankamp now we have another issue. In 0.39.0, enums correctly use the same name whether you use JavaScript or TypeScript. However, this is a breaking change for TypeScript users. At the same time, we can't revert that change in combination with this request since there would be export clashes. I think we will have to revert enums export from |
Description
With #358 the enums are written into a separate file, this breaks all our existing imports.
Is it possible to add
export * from './enums.gen'
to index.ts?What was the exact reason to move the enums into their own file?
The text was updated successfully, but these errors were encountered: