【发布时间】:2023-03-07 19:29:06
【问题描述】:
我有一个接口,用于详细输入值:
input DocumentDetailInput {
vat: Float!
isSaleWithPrescription: Boolean!
valueCountRound: Float!
paymentType: String!
exportNoBill: Boolean!
}
然后,我只想添加 2 个值:
detail: {
vat: input.vat,
exportNoBill: input.exportNobill
},
错误:
is missing the following properties from type 'DocumentDetail': valueCountRound, isSaleWithPrescription, paymentType.ts(2740)
【问题讨论】:
-
你不能只从界面中排除事物,这就是界面的全部意义。
-
这里有什么问题?你有一个没有可选属性的定义接口,创建了一个没有所有字段的接口类型的对象,打字稿因此对你生气并抛出错误。这正是应该发生的事情
标签: javascript mongodb types graphql nestjs