@infra-blocks/types 0.32.0 → 0.33.0-alpha.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.
@@ -27,6 +27,10 @@ export type Brand<T extends PropertyKey = PropertyKey> = {
27
27
  [k in T]: true;
28
28
  };
29
29
  };
30
+ /**
31
+ * A type alias for {@link NotUndefined}, because double negation sucks azz.
32
+ */
33
+ export type Defined<T> = Exclude<T, undefined>;
30
34
  /**
31
35
  * Convenience type to represent environment variables.
32
36
  */
@@ -36,11 +40,26 @@ export type EnvironmentVariables = Record<string, string | undefined>;
36
40
  */
37
41
  export type EnvVars = EnvironmentVariables;
38
42
  /**
39
- * Convenient type alias to regroup a type that can be T, null or undefined.
43
+ * A type representing nil types, also known as "nullable" types in Typescript
44
+ * utility types terminology.
45
+ */
46
+ export type Nil = null | undefined;
47
+ /**
48
+ * A type utility excluding `null` and `undefined` from `T`.
40
49
  *
41
- * Semantically the opposite of {@link NonNullable}.
50
+ * This is an alias for the built-in `NonNullable` utility type. It is only provided
51
+ * so that calling code can revolve around the same naming conventions with regards
52
+ * to `null | undefined` types.
53
+ */
54
+ export type NotNil<T> = NonNullable<T>;
55
+ /**
56
+ * A type utility excluding `null` from `T`.
57
+ */
58
+ export type NotNull<T> = Exclude<T, null>;
59
+ /**
60
+ * Excludes `undefined` from `T`.
42
61
  */
43
- export type Nullable<T> = T | null | undefined;
62
+ export type NotUndefined<T> = Exclude<T, undefined>;
44
63
  /**
45
64
  * A utility type for tracking a phantom type parameter.
46
65
  */
@@ -27,6 +27,10 @@ export type Brand<T extends PropertyKey = PropertyKey> = {
27
27
  [k in T]: true;
28
28
  };
29
29
  };
30
+ /**
31
+ * A type alias for {@link NotUndefined}, because double negation sucks azz.
32
+ */
33
+ export type Defined<T> = Exclude<T, undefined>;
30
34
  /**
31
35
  * Convenience type to represent environment variables.
32
36
  */
@@ -36,11 +40,26 @@ export type EnvironmentVariables = Record<string, string | undefined>;
36
40
  */
37
41
  export type EnvVars = EnvironmentVariables;
38
42
  /**
39
- * Convenient type alias to regroup a type that can be T, null or undefined.
43
+ * A type representing nil types, also known as "nullable" types in Typescript
44
+ * utility types terminology.
45
+ */
46
+ export type Nil = null | undefined;
47
+ /**
48
+ * A type utility excluding `null` and `undefined` from `T`.
40
49
  *
41
- * Semantically the opposite of {@link NonNullable}.
50
+ * This is an alias for the built-in `NonNullable` utility type. It is only provided
51
+ * so that calling code can revolve around the same naming conventions with regards
52
+ * to `null | undefined` types.
53
+ */
54
+ export type NotNil<T> = NonNullable<T>;
55
+ /**
56
+ * A type utility excluding `null` from `T`.
57
+ */
58
+ export type NotNull<T> = Exclude<T, null>;
59
+ /**
60
+ * Excludes `undefined` from `T`.
42
61
  */
43
- export type Nullable<T> = T | null | undefined;
62
+ export type NotUndefined<T> = Exclude<T, undefined>;
44
63
  /**
45
64
  * A utility type for tracking a phantom type parameter.
46
65
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infra-blocks/types",
3
- "version": "0.32.0",
3
+ "version": "0.33.0-alpha.0",
4
4
  "description": "Typescript types utility package.",
5
5
  "keywords": [
6
6
  "type",