Skip to content

Generate working enums with numeric fields #30

Open
@antonioorct

Description

@antonioorct

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions