Skip to content

Commit

Permalink
feat(typing): add IsAny and IsNotAny
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Sep 1, 2024
1 parent e1ac7b5 commit 0d8fce3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions typing/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,9 @@ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array

/** Possible values to `typeof` operator. */
export type TypeOf = "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function"

/** Check if a type is `any`. */
export type IsAny<T> = boolean extends (T extends never ? true : false) ? true : false

/** Check if a type is not `any`. */
export type IsNotAny<T> = IsAny<T> extends true ? false : true

0 comments on commit 0d8fce3

Please sign in to comment.