@webergency-utils/typechecker 0.1.4 → 0.1.5

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.
@@ -42,3 +42,18 @@ type ApplyModifiers<T, EntriesList extends any[]> = EntriesList extends [[infer
42
42
  * Utility type to decorate nested properties of a type with validation/transform modifiers without retyping the structure.
43
43
  */
44
44
  export type WithModifiers<T, M> = ApplyModifiers<T, TuplifyUnion<Entries<M>>>;
45
+ /**
46
+ * Recursively resolves object properties, removing the optional `?` modifier
47
+ * from any properties that have a `tag.Default` applied.
48
+ */
49
+ export type ResolveDefaults<T> = T extends Date | symbol | string | number | boolean | bigint | null | undefined | Function ? T : T extends Array<infer U> ? Array<ResolveDefaults<U>> : T extends object ? {
50
+ [K in keyof T as NonNullable<T[K]> extends {
51
+ readonly __default: any;
52
+ } ? K : never]-?: ResolveDefaults<Exclude<T[K], undefined>>;
53
+ } & {
54
+ [K in keyof T as NonNullable<T[K]> extends {
55
+ readonly __default: any;
56
+ } ? never : K]: ResolveDefaults<T[K]>;
57
+ } extends infer O ? {
58
+ [K in keyof O]: O[K];
59
+ } : never : T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webergency-utils/typechecker",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "description": "TypeScript compiler plugin for runtime validation",
6
6
  "author": "radixxko",