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

Class with Enum field leads to a TypeError #85

Closed
arbue opened this issue Aug 30, 2020 · 2 comments
Closed

Class with Enum field leads to a TypeError #85

arbue opened this issue Aug 30, 2020 · 2 comments
Assignees
Labels
bug Something isn't working released

Comments

@arbue
Copy link

arbue commented Aug 30, 2020

Hi @nartc,

currently I am using the automapper-transformer-plugin in combination with nestjs. It works great for all of my types as indended, but if I create a class with an enum type the compiler throws a TypeException.

Error:

 TypeError: Cannot read property 'transformFlags' of undefined

A workaround is to add the @AutoMap() annotation manually to the enum field.

Could you look into this issue.

Versions:
NestJs: 7.0.0
nestjsx-automapper: 3.1.0
@nartc/automapper-transformer-plugin: 1.0.20
typescript: 3.7.4

Not working example:

enum State {
  READY,
  STOPED
}

export class ExampleEntity {
  state: State;
  id: number;

  constructor() {
    this.state = State.READY;
  }
}

Working example:

enum State {
  READY,
  STOPED
}

export class ExampleEntity {
  @AutoMap() state: State;
  id: number;

  constructor() {
    this.state = State.READY;
  }
}
@nartc
Copy link
Owner

nartc commented Aug 30, 2020

Thanks for reporting. Recently, TS has a couple of releases and the latest release is a major version bump. This transformer plugin also has some problem with inheritance as well which I'll look into. However, I'm pretty busy with work currently so the earliest I can take a look is next weekend. Sorry for any inconvenience :)

@nartc nartc self-assigned this Aug 30, 2020
@nartc nartc added the bug Something isn't working label Aug 30, 2020
@nartc nartc closed this as completed in 392769e Sep 6, 2020
@nartc
Copy link
Owner

nartc commented Sep 6, 2020

🎉 This issue has been resolved in version 1.0.21 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nartc nartc added the released label Sep 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants