• Equivalent to calling vitest.expect(arg).toBeUndefined() while also asserting arg to be undefined.

    Parameters

    • arg: unknown

      The variable to be asserted.

    Returns asserts arg is undefined

    undefined.

    arg is undefined.

    const iAmUndefined: number | undefined = Math.random() >= 0 ? 10 : undefined;
    expectToBeUndefined(iAmUndefined);
    expect(iAmUndefined + 1).toBe(11);
    // ^ 'iAmUndefined' is possibly 'undefined'.