utilium 2.5.9 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/objects.d.ts +13 -0
- package/package.json +1 -1
package/dist/objects.d.ts
CHANGED
|
@@ -69,6 +69,18 @@ export declare function bindFunctions<T extends object, This = any>(fns: T, this
|
|
|
69
69
|
export type Mutable<T> = {
|
|
70
70
|
-readonly [P in keyof T]: T[P];
|
|
71
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* Makes all properties in T readonly recursively
|
|
74
|
+
*/
|
|
75
|
+
export type ReadonlyRecursive<T> = T extends object ? {
|
|
76
|
+
readonly [K in keyof T]: ReadonlyRecursive<T[K]>;
|
|
77
|
+
} : T;
|
|
78
|
+
/**
|
|
79
|
+
* Makes all properties in T mutable recursively
|
|
80
|
+
*/
|
|
81
|
+
export type MutableRecursive<T> = T extends object ? {
|
|
82
|
+
-readonly [P in keyof T]: MutableRecursive<T[P]>;
|
|
83
|
+
} : T;
|
|
72
84
|
/**
|
|
73
85
|
* Makes properties with keys assignable to K in T required
|
|
74
86
|
* @see https://stackoverflow.com/a/69328045/17637456
|
|
@@ -136,3 +148,4 @@ export type Never<T> = {
|
|
|
136
148
|
* All of the properties in T or none of them
|
|
137
149
|
*/
|
|
138
150
|
export type AllOrNone<T> = T | Never<T>;
|
|
151
|
+
export type Filter<Key, Arr extends readonly any[]> = Arr extends readonly [infer L, ...infer R] ? L extends Key ? Filter<Key, R> : [L, ...Filter<Key, R>] : [];
|