BUPKIS
    Preparing search index...

    Variable AsyncFunctionSchemaConst

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

    A Zod schema that validates functions declared with the async keyword.

    This schema validates functions that are explicitly declared as asynchronous using the async keyword. It uses runtime introspection to check the function's internal [[ToString]] representation to distinguish async functions from regular functions that might return Promises.

    This schema cannot match a function that returns a Promise but was not declared via async. Determining if a function returns a Promise is only possible by execution of said function (which BUPKIS avoids, naturally). This is a limitation of JavaScript itself.

    async function asyncFn() {
    return 42;
    }
    AsyncFunctionSchema.parse(asyncFn); // ✓ Valid

    const asyncArrow = async () => 42;
    AsyncFunctionSchema.parse(asyncArrow); // ✓ Valid

    function syncFn() {
    return Promise.resolve(42);
    }
    AsyncFunctionSchema.parse(syncFn); // ✗ Throws validation error

    const regularFn = () => 42;
    AsyncFunctionSchema.parse(regularFn); // ✗ Throws validation error
    import { createAssertion, use } from 'bupkis';
    import { AsyncFunctionSchema } from 'bupkis/schema';

    const asyncFnAssertion = createAssertion(
    [AsyncFunctionSchema, 'to be an async function'],
    AsyncFunctionSchema,
    );

    const { expect } = use([asyncFnAssertion]);
    expect(async () => {}, 'to be an async function');