• Safely parses the input using the provided Zod schema (v3 or v4) and returns a result object indicating success or failure. This function is compatible with both Zod v3 and v4 schemas.

    Type Parameters

    • T

      The expected output type of the schema.

    Parameters

    • schema: InteropZodType<T, T>

      The Zod schema (v3 or v4) to use for parsing.

    • input: unknown

      The input value to parse.

    Returns InteropZodSafeParseResult<T>

    An object with either the parsed data (on success) or the error (on failure).

    If the schema is not a recognized Zod v3 or v4 schema.