Checks if all the assertions pass.

If you have two or three assertions consider using and2 or and3 respectively.

const userEmail = and([string, minLength(5), maxLength(35), email]);

userEmail(1); // Error: type
userEmail("a"); // Error: minLength
userEmail("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa@test.com"); // Error: maxLength
userEmail("Hello world"); // Error: email
userEmail("yamiteru@icloud.com"); // passes
  • Type Parameters

    • const $Values extends unknown[]

    Parameters

    • assertions: {
          [$Key in string | number | symbol]: Assertion<$Values[$Key<$Key>]>
      }

      Array of assertions to be checked.

    Returns Assertion<Intersection<$Values>>