@webdeveric/utils 0.45.0 → 0.45.1
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,12 +1,12 @@
|
|
|
1
1
|
export type ArrayPredicateFn<A, T extends A = A> = ((value: T, index: number, array: readonly A[]) => value is T) | ((value: T, index: number, array: readonly A[]) => unknown);
|
|
2
2
|
export type CompareFn<T> = (a: T, b: T) => number;
|
|
3
3
|
export type TypePredicateFn<T> = (input: unknown, ...args: any[]) => input is T;
|
|
4
|
-
export type InferPredicateReturnType<Fn
|
|
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
7
|
}[number];
|
|
8
8
|
export type TypeAssertionFn<T> = (input: unknown, ...args: any[]) => asserts input is T;
|
|
9
|
-
export type InferAssertionReturnType<Fn
|
|
9
|
+
export type InferAssertionReturnType<Fn> = Fn extends TypeAssertionFn<infer T> ? T : never;
|
|
10
10
|
export type InferAssertionsReturnType<Fns extends TypeAssertionFn<unknown>[]> = {
|
|
11
11
|
[K in keyof Fns]: InferAssertionReturnType<Fns[K]>;
|
|
12
12
|
}[number];
|