@ptolemy2002/ts-utils 3.5.1 → 3.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/README.md +3 -0
- package/dist/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,9 @@ This type returns a union of all the keys in `T` that have a value assignable to
|
|
|
41
41
|
### PartialBy<T, K extends keyof T>
|
|
42
42
|
This type returns a type that is the same as `T` except that the keys in `K` are optional.
|
|
43
43
|
|
|
44
|
+
### RequiredBy<T, K extends keyof T>
|
|
45
|
+
This type returns a type that is the same as `T` except that the keys in `K` are required.
|
|
46
|
+
|
|
44
47
|
### AtLeastOne<T, U = {[K in keyof T]: Pick<T, K> }>
|
|
45
48
|
This type returns a type that is the same as `T` except that at least one key is required.
|
|
46
49
|
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export type KeysNotMatchingEqualTypes<T, V> = {
|
|
|
22
22
|
[K in keyof T]-?: EqualTypes<T[K], V, never, K>;
|
|
23
23
|
}[keyof T];
|
|
24
24
|
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
25
|
+
export type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
|
|
25
26
|
export type AtLeastOne<T, U = {
|
|
26
27
|
[K in keyof T]: Pick<T, K>;
|
|
27
28
|
}> = Partial<T> & U[keyof U];
|