summaryrefslogtreecommitdiff
path: root/lib/types/fn/callable.ts
diff options
context:
space:
mode:
authorElizabeth Hunt <me@liz.coffee>2025-07-27 17:03:10 -0700
committerElizabeth Hunt <me@liz.coffee>2025-07-27 18:30:30 -0700
commit9970036d203ba2d0a46b35ba6fad21d49441cdd4 (patch)
treea585d13933bf4149dcb07e28526063d071453105 /lib/types/fn/callable.ts
downloadpengueno-9970036d203ba2d0a46b35ba6fad21d49441cdd4.tar.gz
pengueno-9970036d203ba2d0a46b35ba6fad21d49441cdd4.zip
hai
Diffstat (limited to 'lib/types/fn/callable.ts')
-rw-r--r--lib/types/fn/callable.ts21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/types/fn/callable.ts b/lib/types/fn/callable.ts
new file mode 100644
index 0000000..60d747b
--- /dev/null
+++ b/lib/types/fn/callable.ts
@@ -0,0 +1,21 @@
+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 Predicate<T> extends Mapper<T, boolean> {}
+
+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> {}