• Validates that all required fields are set in the target object and throws an error when a required field is missing or when an unknown field is set.

    Type Parameters

    • T extends object

    Parameters

    • schema: Definition

      Schema to validate against

    • obj: T

      Object to validate

    • Optional options: {
          allowUnknown?: boolean;
      }

      Options that control what is validated

      • Optional allowUnknown?: boolean

    Returns T