@webdeveric/utils 0.51.0 → 0.52.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.
@@ -1,3 +1,3 @@
1
1
  import type { InferPredicatesReturnType, TypePredicateFn } from '../types/functions.js';
2
- import type { UnionToIntersection } from '../types/utils.js';
3
- export declare const allOf: <Predicates extends TypePredicateFn<unknown>[]>(...predicates: Predicates) => TypePredicateFn<UnionToIntersection<InferPredicatesReturnType<Predicates>>>;
2
+ import type { IntersectionOf } from '../types/utils.js';
3
+ export declare const allOf: <Predicates extends TypePredicateFn<unknown>[]>(...predicates: Predicates) => TypePredicateFn<IntersectionOf<InferPredicatesReturnType<Predicates>>>;
@@ -1,2 +1,3 @@
1
1
  import type { InferPredicatesReturnType, TypePredicateFn } from '../types/functions.js';
2
- export declare const anyOf: <Predicates extends TypePredicateFn<unknown>[]>(...predicates: Predicates) => TypePredicateFn<InferPredicatesReturnType<Predicates>>;
2
+ import type { UnionOf } from '../types/utils.js';
3
+ export declare const anyOf: <Predicates extends TypePredicateFn<unknown>[]>(...predicates: Predicates) => TypePredicateFn<UnionOf<InferPredicatesReturnType<Predicates>>>;
@@ -4,7 +4,7 @@ export type TypePredicateFn<T> = (input: unknown, ...args: any[]) => input is T;
4
4
  export type InferPredicateReturnType<Fn> = Fn extends TypePredicateFn<infer T> ? T : never;
5
5
  export type InferPredicatesReturnType<Predicates extends TypePredicateFn<unknown>[]> = {
6
6
  [K in keyof Predicates]: InferPredicateReturnType<Predicates[K]>;
7
- }[number];
7
+ };
8
8
  export type TypeAssertionFn<T> = (input: unknown, ...args: any[]) => asserts input is T;
9
9
  export type InferAssertionReturnType<Fn> = Fn extends TypeAssertionFn<infer T> ? T : never;
10
10
  export type InferAssertionsReturnType<Fns extends TypeAssertionFn<unknown>[]> = {
@@ -23,7 +23,8 @@ export type OptionalExcept<Type, Keys extends keyof Type> = Type extends any ? P
23
23
  export type RequiredExcept<Type, Keys extends keyof Type> = Type extends any ? Required<Omit<Type, Keys>> & Partial<Pick<Type, Keys>> : never;
24
24
  export type OptionalKeys<Type, Keys extends keyof Type> = Type extends any ? Omit<Type, Keys> & Partial<Pick<Type, Keys>> : never;
25
25
  export type RequiredKeys<Type, Keys extends keyof Type> = Type extends any ? Omit<Type, Keys> & Required<Pick<Type, Keys>> : never;
26
- export type NonVoid<Type> = Type extends void ? never : Type;
26
+ export type NonVoid<Type> = Exclude<Type, void>;
27
+ export type Defined<Type> = Exclude<Type, undefined | void>;
27
28
  export type RemoveNever<Type> = {
28
29
  [Key in keyof Type as [Type[Key]] extends [never] ? never : Key]: Type[Key];
29
30
  };
@@ -39,6 +40,8 @@ export type DeepPartial<Type> = Type extends object ? {
39
40
  [Property in keyof Type]?: DeepPartial<Type[Property]>;
40
41
  } : Type;
41
42
  export type UnionToIntersection<Union> = (Union extends any ? (union: Union) => void : never) extends (union: infer Type extends Union) => void ? Type : never;
43
+ export type IntersectionOf<T extends unknown[]> = T extends [infer First, ...infer Rest] ? First & IntersectionOf<Rest> : unknown;
44
+ export type UnionOf<T extends unknown[]> = T extends [infer First, ...infer Rest] ? First | UnionOf<Rest> : never;
42
45
  export type Pretty<Type> = {
43
46
  [Property in keyof Type]: Type[Property];
44
47
  } & unknown;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@webdeveric/utils",
3
3
  "description": "Just another collection of utilities.",
4
- "version": "0.51.0",
4
+ "version": "0.52.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -87,7 +87,7 @@
87
87
  "devDependencies": {
88
88
  "@commitlint/config-conventional": "^19.7.1",
89
89
  "@commitlint/types": "^19.5.0",
90
- "@types/node": "^22.13.5",
90
+ "@types/node": "^22.13.8",
91
91
  "@vitest/coverage-v8": "^3.0.7",
92
92
  "@webdeveric/eslint-config-ts": "^0.11.0",
93
93
  "@webdeveric/prettier-config": "^0.3.0",
@@ -96,7 +96,7 @@
96
96
  "conventional-changelog-conventionalcommits": "^8.0.0",
97
97
  "cspell": "^8.17.5",
98
98
  "eslint": "^8.57.1",
99
- "eslint-config-prettier": "^10.0.1",
99
+ "eslint-config-prettier": "^10.0.2",
100
100
  "eslint-import-resolver-typescript": "^3.8.3",
101
101
  "eslint-plugin-import": "^2.31.0",
102
102
  "husky": "^9.1.7",
@@ -105,7 +105,7 @@
105
105
  "prettier": "^3.5.2",
106
106
  "rimraf": "^6.0.1",
107
107
  "semantic-release": "^24.2.3",
108
- "typescript": "^5.7.3",
108
+ "typescript": "^5.8.2",
109
109
  "validate-package-exports": "^0.8.0",
110
110
  "vitest": "^3.0.7"
111
111
  }