Skip to content
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

Generate working enums with numeric fields #30

Open
antonioorct opened this issue Feb 14, 2025 · 0 comments
Open

Generate working enums with numeric fields #30

antonioorct opened this issue Feb 14, 2025 · 0 comments

Comments

@antonioorct
Copy link

antonioorct commented Feb 14, 2025

I've got an enum in a PG database like this:

CREATE TYPE public."company_sizes" AS ENUM (
	'1-10',
	'11-50',
	'51-100',
	'101-500',
	'501-1000',
	'1001-5000',
	'5000+');

The library generates an enum:

export enum CompanySizes {
  110 = "1-10",
  1150 = "11-50",
  51100 = "51-100",
  101500 = "101-500",
  5011000 = "501-1000",
  10015000 = "1001-5000",
  5000 = "5000+",
}

This brings up the error An enum member cannot have a numeric name.ts(2452)

I don't think there is a way to overwrite the generated enum type so it would be nice to have an out-of-the-box functioning solution for this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant