1 | import { Match } from '../Any/_Internal';
|
---|
2 | import { Is } from '../Any/Is';
|
---|
3 | import { At } from '../Any/At';
|
---|
4 | import { Keys } from '../Any/Keys';
|
---|
5 | /**
|
---|
6 | * @hidden
|
---|
7 | */
|
---|
8 | export declare type _IntersectMatch<O extends object, O1 extends object, match extends Match> = {
|
---|
9 | [K in keyof O]-?: {
|
---|
10 | 1: K;
|
---|
11 | 0: never;
|
---|
12 | }[Is<O[K], At<O1, K>, match>];
|
---|
13 | }[keyof O];
|
---|
14 | /**
|
---|
15 | * @hidden
|
---|
16 | */
|
---|
17 | declare type IntersectMatch<O extends object, O1 extends object, match extends Match> = O extends unknown ? _IntersectMatch<O, O1, match> : never;
|
---|
18 | /**
|
---|
19 | * Get the intersecting keys of `O` & `O1`
|
---|
20 | * (If `match = 'default'`, no type checks are done)
|
---|
21 | * @param O to check similarities with
|
---|
22 | * @param O1 to check similarities against
|
---|
23 | * @returns [[Key]]
|
---|
24 | * @example
|
---|
25 | * ```ts
|
---|
26 | * ```
|
---|
27 | */
|
---|
28 | export declare type IntersectKeys<O extends object, O1 extends object, match extends Match = 'default'> = {
|
---|
29 | 'default': Keys<O> & Keys<O1>;
|
---|
30 | 'contains->': IntersectMatch<O, O1, 'contains->'>;
|
---|
31 | 'extends->': IntersectMatch<O, O1, 'extends->'>;
|
---|
32 | '<-contains': IntersectMatch<O, O1, '<-contains'>;
|
---|
33 | '<-extends': IntersectMatch<O, O1, '<-extends'>;
|
---|
34 | 'equals': IntersectMatch<O, O1, 'equals'>;
|
---|
35 | }[match];
|
---|
36 | export {};
|
---|