-
-
Notifications
You must be signed in to change notification settings - 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
.
-
Type
extendsBase
(default:any
) -
Base
(default:unknown
) -
Args
extendsreadonly unknown[]
(default:any[]
)
const isString: Predicate<string> = (it: unknown): it is string => (
typeof it === "string"
);