BUPKIS
    Preparing search index...

    Variable FunctionSchemaConst

    FunctionSchema: ZodCustom<
        (...args: unknown[] | readonly unknown[]) => unknown,
        (...args: unknown[] | readonly unknown[]) => unknown,
    > = ...

    A Zod schema that validates any JavaScript function.

    This schema accepts a function having any signature and avoids Zod's parsing overhead.

    Zod v~4.0.0 changed how z.function() worked, which made it unsuitable for validation. This was reverted in Zod v4.1.0.

    FunctionSchema.parse(function () {}); // ✓ Valid
    FunctionSchema.parse(() => {}); // ✓ Valid
    FunctionSchema.parse(async () => {}); // ✓ Valid
    FunctionSchema.parse(function* () {}); // ✓ Valid
    FunctionSchema.parse(Math.max); // ✓ Valid
    FunctionSchema.parse('not a function'); // ✗ Throws validation error
    FunctionSchema.parse({}); // ✗ Throws validation error
    import { createAssertion, use } from 'bupkis';
    import { FunctionSchema } from 'bupkis/schema';

    const fnAssertion = createAssertion(
    [FunctionSchema, 'to be a function with arity 2'],
    FunctionSchema.refine((subject) => subject.length === 2),
    );
    const { expect } = use([fnAssertion]);
    function add(a: number, b: number) {
    return a + b;
    }
    expect(add, 'to be a function with arity 2');