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:
674 bytes
|
Line | |
---|
1 | import { Last } from './Last';
|
---|
2 | import { Prepend } from '../List/Prepend';
|
---|
3 | import { Exclude } from './Exclude';
|
---|
4 | import { List } from '../List/List';
|
---|
5 | import { Cast } from '../Any/Cast';
|
---|
6 | import { Extends } from '../Any/Extends';
|
---|
7 | /**
|
---|
8 | * @hidden
|
---|
9 | */
|
---|
10 | declare type _ListOf<U, LN extends List = [], LastU = Last<U>> = {
|
---|
11 | 0: _ListOf<Exclude<U, LastU>, Prepend<LN, LastU>>;
|
---|
12 | 1: LN;
|
---|
13 | }[Extends<[U], [never]>];
|
---|
14 | /**
|
---|
15 | * Transform a [[Union]] into a [[List]]
|
---|
16 | * (⚠️ it might not preserve order)
|
---|
17 | * @param U to transform
|
---|
18 | * @returns [[List]]
|
---|
19 | * @example
|
---|
20 | * ```ts
|
---|
21 | * ```
|
---|
22 | */
|
---|
23 | export declare type ListOf<U extends any> = _ListOf<U> extends infer X ? Cast<X, List> : never;
|
---|
24 | export {};
|
---|
Note:
See
TracBrowser
for help on using the repository browser.