Skip to content

Commit 53800cd

Browse files
Update computed signature to include any case (#28)
...also pipe
1 parent bb43f91 commit 53800cd

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

typescript/packages/common-frp/src/operators.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ export type Pipe = {
7878
g2h: UnaryFn<G, H>,
7979
h2i: UnaryFn<H, I>
8080
): I
81+
82+
(
83+
value: any,
84+
...fns: [(value: any) => any]
85+
): any
8186
}
8287

8388
/** Pipe a value through a series of functions */

typescript/packages/common-frp/src/signal.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const state = <T>(initial: T) => {
117117
}
118118
}
119119

120-
export type computed = {
120+
export type Computed = {
121121
<A, B, Z>(
122122
upstreams: [Signal<A>, Signal<B>],
123123
compute: (a: A, b: B) => Z
@@ -175,9 +175,13 @@ export type computed = {
175175
],
176176
compute: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H) => Z
177177
): Signal<Z>
178+
(
179+
upstreams: Array<Signal<any>>,
180+
compute: (...values: any) => any
181+
): Signal<any>
178182
}
179183

180-
export const computed: computed = (
184+
export const computed: Computed = (
181185
upstreams: Array<Signal<any>>,
182186
compute: (...values: Array<any>) => any
183187
): Signal<any> => {

0 commit comments

Comments
 (0)