TS2740缺少类型,Typescript,NestJS的以下属性

时间:2020-03-16 15:41:28

标签: javascript mongodb types graphql nestjs

我有一个界面,用于输入详细信息:

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)

1 个答案:

答案 0 :(得分:0)

谢谢大家! 我有解决方法

const detailInput = {
      vat: input.vat,
      exportNoBill: input.exportNobill
    } as DocumentDetailInput

detail: DocumentDetailInput

现在我不能仅仅从DocumentDetailInput接口中排除内容!