rambdax
Version:
Extended version of Rambda - a lightweight, faster alternative to Ramda
26 lines (24 loc) • 834 B
text/typescript
import {Key} from '../Any/Key'
import {Either as OEither} from '../Object/Either'
import {ObjectOf} from './ObjectOf'
import {_ListOf} from '../Object/ListOf'
import {List} from './List'
import {Boolean} from '../Boolean/Boolean'
import {NumberOf} from '../Any/_Internal'
/**
Split `L` into a [[Union]] with `K` keys in such a way that none of
the keys are ever present with one another within the different unions.
@param L to split
@param K to split with
@param strict (?=`1`) to force excess property checks https://github.com/microsoft/TypeScript/issues/20863
@returns [[List]] [[Union]]
@example
```ts
```
*/
export type Either<L extends List, K extends Key, strict extends Boolean = 1> =
OEither<ObjectOf<L>, NumberOf<K>, strict> extends infer OE
? OE extends unknown
? _ListOf<OE & {}>
: never
: never