main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.2 KB
|
Line | |
---|
1 | import { _Omit } from './Omit';
|
---|
2 | import { _Pick } from './Pick';
|
---|
3 | import { Key } from '../Any/Key';
|
---|
4 | import { Strict } from '../Union/Strict';
|
---|
5 | import { Boolean } from '../Boolean/_Internal';
|
---|
6 | import { ComputeRaw } from '../Any/Compute';
|
---|
7 | /**
|
---|
8 | * @hidden
|
---|
9 | */
|
---|
10 | declare type __Either<O extends object, K extends Key> = _Omit<O, K> & ({
|
---|
11 | [P in K]: _Pick<O, P>;
|
---|
12 | }[K]);
|
---|
13 | /**
|
---|
14 | * @hidden
|
---|
15 | */
|
---|
16 | declare type EitherStrict<O extends object, K extends Key> = Strict<__Either<O, K>>;
|
---|
17 | /**
|
---|
18 | * @hidden
|
---|
19 | */
|
---|
20 | declare type EitherLoose<O extends object, K extends Key> = ComputeRaw<__Either<O, K>>;
|
---|
21 | /**
|
---|
22 | * @hidden
|
---|
23 | */
|
---|
24 | export declare type _Either<O extends object, K extends Key, strict extends Boolean> = {
|
---|
25 | 1: EitherStrict<O, K>;
|
---|
26 | 0: EitherLoose<O, K>;
|
---|
27 | }[strict];
|
---|
28 | /**
|
---|
29 | * Split `O` into a [[Union]] with `K` keys in such a way that none of
|
---|
30 | * the keys are ever present with one another within the different unions.
|
---|
31 | * @param O to split
|
---|
32 | * @param K to split with
|
---|
33 | * @param strict (?=`1`) to force excess property checks https://github.com/microsoft/TypeScript/issues/20863
|
---|
34 | * @returns [[Object]] [[Union]]
|
---|
35 | * @example
|
---|
36 | * ```ts
|
---|
37 | * ```
|
---|
38 | */
|
---|
39 | export declare type Either<O extends object, K extends Key, strict extends Boolean = 1> = O extends unknown ? _Either<O, K, strict> : never;
|
---|
40 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.