gristlabs/ts-interface-checker

Duplicate "is extraneous" errors

darkalor opened this issue · 0 comments

Can't share exact code, but this should be roughly it

Types

interface Data {
  description: string
  properties: FieldsMap
}

type fieldName = string
type FieldsMap = { [key: fieldName]: Field}

interface Field {
  description: string
}

Data:

const data = {
  description: 'test',
  properties: {
    "some.field": {
      description: 'test',
      extraFields: { boop: false },
    }
  }
}

strictValidate output

[
   {
      "path":"value.properties",
      "message":"is not a FieldsMap",
      "nested":[
         {
            "path":"value.properties.some.field",
            "message":"is not a Field",
            "nested":[
               {
                  "path":"value.properties.some.field.extraFields",
                  "message":"is extraneous"
               },
               {
                  "path":"value.properties.some.field.extraFields",
                  "message":"is extraneous"
               }
            ]
         }
      ]
   }
]