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

[Feature Request] Also generate an enum #765

Open
Zer0xxxx opened this issue May 31, 2024 · 0 comments
Open

[Feature Request] Also generate an enum #765

Zer0xxxx opened this issue May 31, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Zer0xxxx
Copy link

Zer0xxxx commented May 31, 2024

Version

5.26.2

Describe the bug

It would be great to also codegen an enum like so:

enum ELocales {
  'en-US' = 'en-US',
  'fr' = 'fr'
}

An example of use-case of it could be to use typesafe-i18n with TypeORM

const decoratorConfigLocalesEnumFragment = {
  default: baseLocale,
  enum: ELocales,
  type: 'enum'
} as const;

@Entity()
class Foo {
  // * ...
  @Column({ nullable: false, ...decoratorConfigLocalesEnumFragment })
  inferedLang!: ELocales;

  @Column({ nullable: true, ...decoratorConfigLocalesEnumFragment })
  lang!: ELocales;

  // * ...
}

Reproduction

Process a codegen with typesafe-i18n, then inspect the i18n-types.ts file.
A desirable enum is missing.

Logs

No response

Config

No response

Additional information

No response

@Zer0xxxx Zer0xxxx added the bug Something isn't working label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant