В TS2740 отсутствуют следующие свойства типа, Typescript, NestJS - PullRequest
0 голосов
/ 16 марта 2020

У меня есть интерфейс для подробного ввода значения:

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 голосов
/ 19 марта 2020

Спасибо всем !! У меня есть решение

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

и

detail: DocumentDetailInput

Теперь я не могу просто исключить вещи из интерфейса DocumentDetailInput !!

...