Equivalent to calling vitest.expect(arg).not.toBeNull() while also asserting arg to non-null.
vitest.expect(arg).not.toBeNull()
arg
The type of arg.
The variable to be asserted.
undefined.
undefined
arg is not null.
const iAmNotNull: number | null = Math.random() < 1 ? 10 : null;expectToBeDefined(iAmNotNull);expect(iAmNotNull + 1).toBe(11); Copy
const iAmNotNull: number | null = Math.random() < 1 ? 10 : null;expectToBeDefined(iAmNotNull);expect(iAmNotNull + 1).toBe(11);
Equivalent to calling
vitest.expect(arg).not.toBeNull()
while also assertingarg
to non-null.