ts-gems 3.7.0 → 3.8.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.
@@ -4,7 +4,18 @@ import { IfNever, IfNull } from './type-check.js';
4
4
  /**
5
5
  * Exclude null and undefined from T deeply
6
6
  */
7
- export type DeepNonNullable<T> = {
7
+ export type UnNullish<T> = {
8
+ [K in keyof T as IfNever<
9
+ Exclude<T[K], undefined>,
10
+ never,
11
+ IfNull<Exclude<T[K], undefined>, never, K>
12
+ >]: NonNullable<T[K]>;
13
+ };
14
+
15
+ /**
16
+ * Exclude null and undefined from T deeply
17
+ */
18
+ export type DeepUnNullish<T> = {
8
19
  [K in keyof T as IfNever<
9
20
  Exclude<T[K], undefined>,
10
21
  never,
@@ -15,22 +26,22 @@ export type DeepNonNullable<T> = {
15
26
  > extends true
16
27
  ? NonNullable<T[K]>
17
28
  : // Deep process objects
18
- DeepNonNullable<NonNullable<T[K]>>;
29
+ DeepUnNullish<NonNullable<T[K]>>;
19
30
  };
20
31
 
21
32
  /**
22
33
  * Exclude null and undefined from T deeply including arrays
23
34
  */
24
- export type DeeperNonNullable<T> = {
35
+ export type DeeperUnNullish<T> = {
25
36
  [K in keyof T as IfNever<
26
37
  Exclude<T[K], undefined>,
27
38
  never,
28
39
  IfNull<Exclude<T[K], undefined>, never, K>
29
40
  >]: NonNullable<Exclude<T[K], undefined>> extends (infer U)[]
30
- ? DeeperNonNullable<U>[]
41
+ ? DeeperUnNullish<U>[]
31
42
  : // Do not deep process No-Deep values
32
43
  IfNoDeepValue<Exclude<T[K], undefined>> extends true
33
44
  ? NonNullable<T[K]>
34
45
  : // Deep process objects
35
- DeeperNonNullable<NonNullable<T[K]>>;
46
+ DeeperUnNullish<NonNullable<T[K]>>;
36
47
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ts-gems",
3
3
  "description": "Valuable typing extensions for TypeScript",
4
- "version": "3.7.0",
4
+ "version": "3.8.0",
5
5
  "license": "MIT",
6
6
  "module": "./lib/index.mjs",
7
7
  "main": "./lib/index.cjs",