- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 0
 
type any or never
        Nicholas Berlette edited this page Jun 19, 2025 
        ·
        1 revision
      
    export type IsAnyOrNever<T, True = true, False = false> = IsNever<
  T,
  True,
  IsAny<T, True, False>
>;Check if the type T is either any or never,
returning True if it is, and
False if not.
This type guard is useful when you need to check if a value can be of any type
or if it is unreachable. If you only need to check if a type is any, use the
IsAny type guard instead.
T- 
True(default:true) - 
False(default:false) 
Types
import type { IsAnyOrNever } from "@nick/is/type/any-or-never";
type A = IsAnyOrNever<never>; // true
type B = IsAnyOrNever<any>; // true
type C = IsAnyOrNever<unknown>; // falseexport type OmitAnyOrNever<T, Deep extends boolean = false> = T extends object ? {
         [K in [object Object]]:
      Deep extends true ? OmitAnyOrNever<T[K], Deep> : T[K]
    } : T;Omit properties from an object type where the value is any or never. This
relies on the IsAnyOrNever
utility type.
T- 
Deepextendsboolean(default:false) 
Types
import type { OmitAnyOrNever } from "@nick/is/type";
type A = { a: string; b: any; c: number; d: never };
type B = OmitAnyOrNever<A>;
//   ^? type B = { a: string; c: number }