summaryrefslogtreecommitdiff
path: root/u/types/fn/callable.ts
diff options
context:
space:
mode:
Diffstat (limited to 'u/types/fn/callable.ts')
-rw-r--r--u/types/fn/callable.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/u/types/fn/callable.ts b/u/types/fn/callable.ts
new file mode 100644
index 0000000..51756d7
--- /dev/null
+++ b/u/types/fn/callable.ts
@@ -0,0 +1,19 @@
+export interface Callable<T = any, ArgT = any> {
+ (...args: Array<ArgT>): T;
+}
+
+export interface Supplier<T> extends Callable<T, undefined> {
+ (): T;
+}
+
+export interface Mapper<T, U> extends Callable<U, T> {
+ (t: T): U;
+}
+
+export interface BiMapper<T, U, R> extends Callable {
+ (t: T, u: U): R;
+}
+
+export interface SideEffect<T> extends Mapper<T, void> {}
+
+export interface BiSideEffect<T, U> extends BiMapper<T, U, void> {}