给定以下实体定义:
@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);
我究竟做错了什么?