例如
export class Tracking extends BaseSchema {
@Prop({ required: true, index: true })
referenceNumber: string;
@Prop({ type: A.schema | B.schema | C.schema})
data: A | B | C
}
这里假设 A、B 和 C 是不同的子文档模式。但是在插入记录时,我将拥有 A、B 或 C 类型的数据。我该如何定义?
我无法定义这样的类型type: A.schema | B.schema | C.schema
。甚至我也不能这样定义data: A | B | C
。它给出了一个错误。