ts-gems 3.0.0 → 3.1.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/lib/nullish.d.ts +5 -5
- package/lib/types.d.ts +6 -0
- package/package.json +1 -1
package/lib/nullish.d.ts
CHANGED
|
@@ -2,15 +2,15 @@ import { IfNoDeepValue } from './helpers';
|
|
|
2
2
|
import { IfNever } from './type-check';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Make all properties in T
|
|
5
|
+
* Make all properties in T nullish
|
|
6
6
|
*/
|
|
7
|
-
export type
|
|
8
|
-
[
|
|
7
|
+
export type NullishObject<T = null> ={
|
|
8
|
+
[K in keyof T as (IfNever<Exclude<T[K], undefined>, never, K>)]?: T[K] | null
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Make all properties in T
|
|
13
|
+
* Make all properties in T nullish deeply
|
|
14
14
|
*/
|
|
15
15
|
export type DeepNullish<T> = {
|
|
16
16
|
[K in keyof T as (IfNever<Exclude<T[K], undefined>, never, K>)]?:
|
|
@@ -21,7 +21,7 @@ export type DeepNullish<T> = {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
* Make all properties in T
|
|
24
|
+
* Make all properties in T nullish deeply including arrays
|
|
25
25
|
*/
|
|
26
26
|
export type DeeperNullish<T> = {
|
|
27
27
|
[K in keyof T as (IfNever<Exclude<T[K], undefined>, never, K>)]?:
|
package/lib/types.d.ts
CHANGED
|
@@ -51,6 +51,12 @@ export type Class<Args extends any[] = any[], Instance = {}, Static = {}> =
|
|
|
51
51
|
*/
|
|
52
52
|
export type Maybe<T> = T | undefined;
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Nullish
|
|
56
|
+
* @desc Type representing T | undefined | null
|
|
57
|
+
*/
|
|
58
|
+
export type Nullish<T = null> = T | undefined | null;
|
|
59
|
+
|
|
54
60
|
|
|
55
61
|
export type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
|
|
56
62
|
|