source: node_modules/ts-toolbelt/out/Object/P/Record.d.ts

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.7 KB
Line 
1import { Modx } from '../_Internal';
2import { IterationOf } from '../../Iteration/IterationOf';
3import { Iteration } from '../../Iteration/Iteration';
4import { Pos } from '../../Iteration/Pos';
5import { Next } from '../../Iteration/Next';
6import { Key } from '../../Any/Key';
7import { LastKey } from '../../List/LastKey';
8import { List } from '../../List/List';
9/**
10 * @hidden
11 */
12declare type Record_RR<Path extends List<Key>, A, I extends Iteration = IterationOf<0>> = {
13 readonly [Key in Path[Pos<I>]]: Pos<I> extends LastKey<Path> ? A : Record_RR<Path, A, Next<I>>;
14} & {};
15/**
16 * @hidden
17 */
18export declare type Record_RW<Path extends List<Key>, A, I extends Iteration = IterationOf<0>> = {
19 [Key in Path[Pos<I>]]: Pos<I> extends LastKey<Path> ? A : Record_RW<Path, A, Next<I>>;
20} & {};
21/**
22 * @hidden
23 */
24declare type Record_OR<Path extends List<Key>, A, I extends Iteration = IterationOf<0>> = {
25 readonly [Key in Path[Pos<I>]]?: Pos<I> extends LastKey<Path> ? A : Record_OR<Path, A, Next<I>>;
26} & {};
27/**
28 * @hidden
29 */
30declare type Record_OW<Path extends List<Key>, A, I extends Iteration = IterationOf<0>> = {
31 [Key in Path[Pos<I>]]?: Pos<I> extends LastKey<Path> ? A : Record_OW<Path, A, Next<I>>;
32} & {};
33/**
34 * Create an object filled with `A` for the fields at the end of `Path`
35 * @param Path to choose fields
36 * @param A to fill fields with
37 * @param modx (?=`['!', 'W']`) to set modifiers
38 * @returns [[Object]]
39 * @example
40 * ```ts
41 * ```
42 */
43export declare type Record<Path extends List<Key>, A, modx extends Modx = ['!', 'W']> = {
44 '!': {
45 'R': Record_RR<Path, A>;
46 'W': Record_RW<Path, A>;
47 };
48 '?': {
49 'R': Record_OR<Path, A>;
50 'W': Record_OW<Path, A>;
51 };
52}[modx[0]][modx[1]];
53export {};
Note: See TracBrowser for help on using the repository browser.