@koine/utils 2.0.0-beta.23 → 2.0.0-beta.24
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/package.json +1 -1
- package/typings.d.ts +19 -15
package/package.json
CHANGED
package/typings.d.ts
CHANGED
|
@@ -4,16 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
// as in type-fest start
|
|
7
|
-
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };
|
|
7
|
+
declare type Simplify<T> = { [KeyType in keyof T]: T[KeyType] };
|
|
8
8
|
// as in type-fest end
|
|
9
9
|
|
|
10
|
-
type NotNullProperties<T> = {
|
|
11
|
-
[P in keyof T]: NonNullable<T[P]>;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
type RequiredNotNullable<T, K extends keyof T> = T &
|
|
15
|
-
Required<NotNullProperties<Pick<T, K>>>;
|
|
16
|
-
|
|
17
10
|
/**
|
|
18
11
|
* Tweak a model by making some properties required (not `optional` and not `nullable`)
|
|
19
12
|
*
|
|
@@ -21,11 +14,22 @@ type RequiredNotNullable<T, K extends keyof T> = T &
|
|
|
21
14
|
*/
|
|
22
15
|
declare type Tweak<
|
|
23
16
|
TModel extends object,
|
|
24
|
-
TRequiredKeys extends keyof TModel |
|
|
25
|
-
TReplacements extends Partial<Record<keyof TModel, unknown>> | false,
|
|
26
|
-
> =
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
TRequiredKeys extends keyof TModel | never,
|
|
18
|
+
TReplacements extends Partial<Record<keyof TModel, unknown>> | false = false,
|
|
19
|
+
> = TReplacements extends false
|
|
20
|
+
? Simplify<
|
|
21
|
+
Omit<TModel, TRequiredKeys> &
|
|
22
|
+
Required<{
|
|
23
|
+
[K in TRequiredKeys]: NonNullable<TModel[K]>;
|
|
24
|
+
}>
|
|
25
|
+
>
|
|
26
|
+
: Simplify<
|
|
27
|
+
Omit<
|
|
28
|
+
Omit<TModel, TRequiredKeys> &
|
|
29
|
+
Required<{
|
|
30
|
+
[K in TRequiredKeys]: NonNullable<TModel[K]>;
|
|
31
|
+
}>,
|
|
32
|
+
keyof TReplacements
|
|
33
|
+
> &
|
|
29
34
|
TReplacements
|
|
30
|
-
|
|
31
|
-
>;
|
|
35
|
+
>;
|