Class with Enum field leads to a TypeError
arbue opened this issue ยท comments
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;
}
}
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 :)
๐ This issue has been resolved in version 1.0.21 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐