Skip to content

Missing property in toi.obj.keys infers the type from missing #122

@alek4e

Description

@alek4e
const validator = toi
      .required()
      .and(toi.obj.is())
      .and(
        toi.obj.keys(
          {
            a: toi
              .required()
              .and(toi.str.is())
              .and(toix.str.guid()),
            b: toi.required().and(toi.num.is()),
            c: toi.required().and(toi.num.is()),
            d: toi
              .optional()
              .and(toi.str.is())
              .and(toi.str.regex(/^([0-9]|[a-z])+([0-9a-z]+)$/i)),
          },
          { missing: ['d'] },
        ),
      );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions