1 | import type {DelimiterCase} from './delimiter-case';
|
2 | import type {NonRecursiveType} from './internal';
|
3 | import type {UnknownArray} from './unknown-array';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | export type DelimiterCasedPropertiesDeep<
|
50 | Value,
|
51 | Delimiter extends string,
|
52 | > = Value extends NonRecursiveType
|
53 | ? Value
|
54 | : Value extends UnknownArray
|
55 | ? DelimiterCasedPropertiesArrayDeep<Value, Delimiter>
|
56 | : Value extends Set<infer U>
|
57 | ? Set<DelimiterCasedPropertiesDeep<U, Delimiter>> : {
|
58 | [K in keyof Value as DelimiterCase<
|
59 | K,
|
60 | Delimiter
|
61 | >]: DelimiterCasedPropertiesDeep<Value[K], Delimiter>;
|
62 | };
|
63 |
|
64 |
|
65 |
|
66 | type DelimiterCasedPropertiesArrayDeep<Value extends UnknownArray, Delimiter extends string> =
|
67 | Value extends []
|
68 | ? []
|
69 |
|
70 | : Value extends [infer U, ...infer V]
|
71 | ? [DelimiterCasedPropertiesDeep<U, Delimiter>, ...DelimiterCasedPropertiesDeep<V, Delimiter>]
|
72 | : Value extends readonly [infer U, ...infer V]
|
73 | ? readonly [DelimiterCasedPropertiesDeep<U, Delimiter>, ...DelimiterCasedPropertiesDeep<V, Delimiter>]
|
74 |
|
75 | : Value extends readonly [...infer U, infer V]
|
76 | ? [...DelimiterCasedPropertiesDeep<U, Delimiter>, DelimiterCasedPropertiesDeep<V, Delimiter>]
|
77 | : Value extends readonly [...infer U, infer V]
|
78 | ? readonly [...DelimiterCasedPropertiesDeep<U, Delimiter>, DelimiterCasedPropertiesDeep<V, Delimiter>]
|
79 |
|
80 | : Value extends Array<infer U>
|
81 | ? Array<DelimiterCasedPropertiesDeep<U, Delimiter>>
|
82 | : Value extends ReadonlyArray<infer U>
|
83 | ? ReadonlyArray<DelimiterCasedPropertiesDeep<U, Delimiter>>
|
84 | : never;
|