1 | import type {CamelCase, CamelCaseOptions} from './camel-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 CamelCasedPropertiesDeep<
|
50 | Value,
|
51 | Options extends CamelCaseOptions = {preserveConsecutiveUppercase: true},
|
52 | > = Value extends NonRecursiveType
|
53 | ? Value
|
54 | : Value extends UnknownArray
|
55 | ? CamelCasedPropertiesArrayDeep<Value>
|
56 | : Value extends Set<infer U>
|
57 | ? Set<CamelCasedPropertiesDeep<U, Options>>
|
58 | : {
|
59 | [K in keyof Value as CamelCase<K, Options>]: CamelCasedPropertiesDeep<
|
60 | Value[K],
|
61 | Options
|
62 | >;
|
63 | };
|
64 |
|
65 |
|
66 |
|
67 | type CamelCasedPropertiesArrayDeep<Value extends UnknownArray> =
|
68 | Value extends []
|
69 | ? []
|
70 | :
|
71 | Value extends [infer U, ...infer V]
|
72 | ? [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
|
73 | : Value extends readonly [infer U, ...infer V]
|
74 | ? readonly [CamelCasedPropertiesDeep<U>, ...CamelCasedPropertiesDeep<V>]
|
75 | :
|
76 | Value extends readonly [...infer U, infer V]
|
77 | ? [...CamelCasedPropertiesDeep<U>, CamelCasedPropertiesDeep<V>]
|
78 | : Value extends readonly [...infer U, infer V]
|
79 | ? readonly [
|
80 | ...CamelCasedPropertiesDeep<U>,
|
81 | CamelCasedPropertiesDeep<V>,
|
82 | ]
|
83 | :
|
84 | Value extends Array<infer U>
|
85 | ? Array<CamelCasedPropertiesDeep<U>>
|
86 | : Value extends ReadonlyArray<infer U>
|
87 | ? ReadonlyArray<CamelCasedPropertiesDeep<U>>
|
88 | : never;
|