//#region src/core/validator.d.ts /** * Type guards for a plugin's `validate` field. A validator is a plain * type-guard function, so a plugin can also use a hand-written one. */ type Validator = (value: unknown) => value is T; declare const string: Validator; declare const number: Validator; declare const boolean: Validator; declare const bigint: Validator; /** Matches an instance of the given constructor. */ declare function instanceOf(ctor: abstract new (...args: never[]) => T): Validator; type Guarded = V extends Validator ? T : never; /** Matches when any of the given validators match. */ declare function union[]>(...validators: V): Validator>; /** Matches the given validator or `undefined`. */ declare function optional(validator: Validator): Validator; /** Matches an array whose items each match `item`. */ declare function array(item: Validator): Validator; type Shape = Record>; type Infer = { [K in keyof S]: Guarded; }; /** * Matches an object whose declared keys each pass their validator. Extra keys * are not checked. */ declare function object(shape: S): Validator>; //#endregion export { instanceOf as a, optional as c, boolean as i, string as l, array as n, number as o, bigint as r, object as s, Validator as t, union as u };