@pogodisco/zephyr 1.3.0 → 1.3.2
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.
- package/dist/utils.d.ts +5 -9
- package/dist/utils.js +9 -6
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
type AnyFn = (...args: any[]) =>
|
|
2
|
-
type Input<F extends AnyFn> = Parameters<F>[0];
|
|
3
|
-
type Output<F extends AnyFn> = Awaited<ReturnType<F>>;
|
|
1
|
+
type AnyFn = (...args: any[]) => any;
|
|
4
2
|
/**
|
|
5
|
-
* For generic actions
|
|
6
|
-
* Just a type helper, does nothing at runtime
|
|
3
|
+
* For generic actions - preserves the generic parameter
|
|
7
4
|
*/
|
|
8
|
-
export declare function genericAction<F extends AnyFn>(fn: F): <T
|
|
5
|
+
export declare function genericAction<F extends AnyFn>(fn: F): <T>() => ((...args: Parameters<F>) => ReturnType<F>);
|
|
9
6
|
/**
|
|
10
|
-
* For fixed actions
|
|
11
|
-
* The type parameter T is for convenience when you want to override the return type
|
|
7
|
+
* For fixed actions
|
|
12
8
|
*/
|
|
13
|
-
export declare function fixedAction<F extends AnyFn>(fn: F):
|
|
9
|
+
export declare function fixedAction<F extends AnyFn>(fn: F): () => ((...args: Parameters<F>) => ReturnType<F>);
|
|
14
10
|
export {};
|
package/dist/utils.js
CHANGED
|
@@ -40,16 +40,19 @@
|
|
|
40
40
|
// }
|
|
41
41
|
//
|
|
42
42
|
/**
|
|
43
|
-
* For generic actions
|
|
44
|
-
* Just a type helper, does nothing at runtime
|
|
43
|
+
* For generic actions - preserves the generic parameter
|
|
45
44
|
*/
|
|
46
45
|
export function genericAction(fn) {
|
|
47
|
-
|
|
46
|
+
// Return a function that takes a type parameter and returns the typed function
|
|
47
|
+
return () => {
|
|
48
|
+
return fn;
|
|
49
|
+
};
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
|
-
* For fixed actions
|
|
51
|
-
* The type parameter T is for convenience when you want to override the return type
|
|
52
|
+
* For fixed actions
|
|
52
53
|
*/
|
|
53
54
|
export function fixedAction(fn) {
|
|
54
|
-
return () =>
|
|
55
|
+
return () => {
|
|
56
|
+
return fn;
|
|
57
|
+
};
|
|
55
58
|
}
|