【发布时间】:2021-01-28 17:04:17
【问题描述】:
给定以下实体定义:
@Entity()
export class User extends BaseEntity {
@Column({ nullable: true })
name!: string | null;
@Column()
age!: number;
}
出现如下错误:
typeORM: "message": "Data type \"Object\" in \"User.name" is not supported by \"postgres\" database."
...
name: 'DataTypeNotSupportedError',
message:
'Data type "Object" in "User.name" is not supported by "postgres" database.' }
查看构建时,我看到 TS 发出的元数据将其作为对象处理:
__decorate([
typeorm_1.Column({ nullable: true }),
__metadata("design:type", Object)
], User.prototype, "name", void 0);
我做错了什么?
【问题讨论】:
-
我找到了这个问题的答案here
标签: node.js typescript postgresql typeorm reflect-metadata