-
-
Couldn't load subscription status.
- Fork 0
type predicate
Nicholas Berlette edited this page Jun 19, 2025
·
1 revision
export type Predicate<
Type extends Base = any,
Base = unknown,
Args extends readonly unknown[] = any[],
> = Expand<(it: Base, ...args: Args) => it is Type>;Represents a type guard (predicate function) that checks if a given value of the
base type Base is also of the derived type Type.
-
TypeextendsBase(default:any) -
Base(default:unknown) -
Argsextendsreadonly unknown[](default:any[])
const isString: Predicate<string> = (it: unknown): it is string => (
typeof it === "string"
);