UNPKG

842 BTypeScriptView Raw
1/**
2 * If the type is possibly null or undefined.
3 */
4export declare type IsNullable<T> = T extends null | undefined ? true : never;
5/**
6 * If the type is not possibly null or undefined.
7 */
8export declare type IsNonNullable<T> = IsNever<IsNullable<T>>;
9/**
10 * If the type has the specified type.
11 */
12export declare type HasType<T, U> = T extends U ? true : never;
13/**
14 * If the type does not have the specified type.
15 */
16export declare type NotHasType<T, U> = IsNever<HasType<T, U>>;
17/**
18 * If the type is the never type.
19 */
20export declare type IsNever<T> = HasType<T, never>;
21/**
22 * If the type is the exact type.
23 * @remarks This is useful for checking if two union types match exactly.
24 */
25export declare type IsExactType<T, U> = Exclude<T, U> extends never ? Exclude<U, T> extends never ? true : never : never;