type-fest/test-d/is-null.ts
2024-04-24 14:06:40 +07:00

12 lines
419 B
TypeScript

import {expectType} from 'tsd';
import type {IsNull} from '../source/is-null';
// https://www.typescriptlang.org/docs/handbook/type-compatibility.html
expectType<IsNull<null>>(true);
expectType<IsNull<any>>(true);
expectType<IsNull<never>>(true);
expectType<IsNull<undefined>>(false); // Depends on `strictNullChecks`
expectType<IsNull<unknown>>(false);
expectType<IsNull<void>>(false);
expectType<IsNull<{}>>(false);