UNPKG

1.34 kBTypeScriptView Raw
1import { Match } from '../Any/_Internal';
2import { UnionOf } from '../Object/UnionOf';
3import { Next } from '../Iteration/Next';
4import { Prev } from '../Iteration/Prev';
5import { Iteration } from '../Iteration/Iteration';
6import { IterationOf } from '../Iteration/IterationOf';
7import { Is } from '../Any/Is';
8import { Boolean } from '../Boolean/_Internal';
9import { Cast } from '../Any/Cast';
10import { Pos } from '../Iteration/Pos';
11/**
12 * @hidden
13 */
14declare type _IncludesDeep<O, M extends any, match extends Match, limit extends number, I extends Iteration = IterationOf<0>> = {
15 0: _IncludesDeep<O extends object ? UnionOf<O> : O, M, match, limit, Next<I>>;
16 1: 1;
17 2: 0;
18}[Pos<Prev<I>> extends limit ? 2 : Is<O, M, match>];
19/**
20 * Check whether `O`, or its sub-objects have fields that match `M`
21 * where the maximum allowed depth is set with `limit`.
22 *
23 * @param O to be inspected
24 * @param M to check field type
25 * @param match (?=`'default'`) to change precision
26 * @param limit (?=`'10'`) to change the check depth
27 * @returns [[Boolean]]
28 * @example
29 * ```ts
30 * ```
31 * @author millsp, ctrlplusb
32 */
33export declare type IncludesDeep<O extends object, M extends any, match extends Match = 'default', limit extends number = 10> = _IncludesDeep<O, M, match, limit> extends infer X ? Cast<X, Boolean> : never;
34export {};