Endo
    Preparing search index...

    Function mustMatch

    • Type-narrowing mustMatch: narrows specimen after the call. Throws if the specimen does not match.

      Type Parameters

      Parameters

      • specimen: any

        The value to test.

      • patt: P

        The pattern to match against.

      • Optionallabel: string | number

        Optional label for error messages.

      Returns asserts specimen is TypeFromPattern<P>

      mustMatch(value, M.string());
      value; // narrowed to string