UNPKG

508 BTypeScriptView Raw
1import { type Predicates } from './predicates.js';
2import type { BasePredicate } from './index.js';
3type Optionalify<P> = P extends BasePredicate<infer X> ? P & BasePredicate<X | undefined> : P;
4export type Modifiers = {
5 /**
6 Make the following predicate optional so it doesn't fail when the value is `undefined`.
7 */
8 readonly optional: {
9 [K in keyof Predicates]: Optionalify<Predicates[K]>;
10 };
11};
12declare const modifiers: <T>(object: T) => T & Modifiers;
13export default modifiers;