utilium 0.4.1 → 0.4.2
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/types.d.ts +7 -0
- package/package.json +1 -1
- package/src/types.ts +6 -0
package/dist/types.d.ts
CHANGED
@@ -181,4 +181,11 @@ export type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never
|
|
181
181
|
* @see https://stackoverflow.com/a/55128956/17637456
|
182
182
|
*/
|
183
183
|
export type UnionToTuple<T, L = LastOfUnion<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<UnionToTuple<Exclude<T, L>>, L>;
|
184
|
+
/**
|
185
|
+
* Makes properties with keys assignable to K in T required
|
186
|
+
* @see https://stackoverflow.com/a/69328045/17637456
|
187
|
+
*/
|
188
|
+
export type WithRequired<T, K extends keyof T> = T & {
|
189
|
+
[P in K]-?: T[P];
|
190
|
+
};
|
184
191
|
export {};
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
@@ -220,3 +220,9 @@ export type LastOfUnion<T> = UnionToIntersection<T extends any ? () => T : never
|
|
220
220
|
* @see https://stackoverflow.com/a/55128956/17637456
|
221
221
|
*/
|
222
222
|
export type UnionToTuple<T, L = LastOfUnion<T>, N = [T] extends [never] ? true : false> = true extends N ? [] : Push<UnionToTuple<Exclude<T, L>>, L>;
|
223
|
+
|
224
|
+
/**
|
225
|
+
* Makes properties with keys assignable to K in T required
|
226
|
+
* @see https://stackoverflow.com/a/69328045/17637456
|
227
|
+
*/
|
228
|
+
export type WithRequired<T, K extends keyof T> = T & { [P in K]-?: T[P] };
|