Disclaimer: I am not entirely sure I understand everything that is happening here, but I'll try my best to make sense.
I am using Typeorm while compiling Typescript with Babel 7, so I need experimentalDecorators (with @babel/plugin-proposal-decorators) and emitDecoratorMetadata (with this package).
Everything runs fine, but when I run the output code, I get the following error: Data type "undefined" in "CharacterEntity.gender" is not supported by "mysql" database., which refer to:
// CharacterEntity.ts
@Entity('characters')
export class CharacterEntity {
// ...
@Column()
gender: CharacterGender;
// ...
}
// CharacterGender.ts
export enum CharacterGender {
MALE = 'male',
FEMALE = 'female'
}
When looking at the code procuded by Babel, I believe only these lines are relevant:
_dec9 = (0, _typeorm.Column)(), _dec10 = Reflect.metadata("design:type", typeof _enums.CharacterGender === "undefined" ? Object : _enums.CharacterGender)
// ...
_descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "gender", [_dec9, _dec10], {
configurable: true,
enumerable: true,
writable: true,
initializer: null
})
// ...
_initializerDefineProperty(this, "gender", _descriptor4, this);
So this issue is blocking me. Note that everything compiles and runs fine when using the Typescript compiler, which seems to produce:
__decorate([
typeorm_1.Column(),
__metadata("design:type", String)
], CharacterEntity.prototype, "gender", void 0);
I hope this is clear enough to provide enough information, it would be great if you could look into this or simply explain what I'm doing wrong :)
Thanks !
Disclaimer: I am not entirely sure I understand everything that is happening here, but I'll try my best to make sense.
I am using Typeorm while compiling Typescript with Babel 7, so I need experimentalDecorators (with @babel/plugin-proposal-decorators) and emitDecoratorMetadata (with this package).
Everything runs fine, but when I run the output code, I get the following error:
Data type "undefined" in "CharacterEntity.gender" is not supported by "mysql" database., which refer to:When looking at the code procuded by Babel, I believe only these lines are relevant:
So this issue is blocking me. Note that everything compiles and runs fine when using the Typescript compiler, which seems to produce:
I hope this is clear enough to provide enough information, it would be great if you could look into this or simply explain what I'm doing wrong :)
Thanks !