summaryrefslogtreecommitdiff
path: root/gjs/src
diff options
context:
space:
mode:
Diffstat (limited to 'gjs/src')
-rw-r--r--gjs/src/variable.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/gjs/src/variable.ts b/gjs/src/variable.ts
index 05e142f..d583ab1 100644
--- a/gjs/src/variable.ts
+++ b/gjs/src/variable.ts
@@ -195,13 +195,14 @@ class VariableWrapper<T> extends Function {
return this as unknown as Variable<T>
}
- static derive<V,
+ static derive<
const Deps extends Array<Variable<any> | Binding<any>>,
Args extends {
[K in keyof Deps]: Deps[K] extends Variable<infer T>
? T : Deps[K] extends Binding<infer T> ? T : never
},
- >(deps: Deps, fn: (...args: Args) => V) {
+ V = Args,
+ >(deps: Deps, fn: (...args: Args) => V = (...args) => args as unknown as V) {
const update = () => fn(...deps.map(d => d.get()) as Args)
const derived = new Variable(update())
const unsubs = deps.map(dep => dep.subscribe(() => derived.set(update())))