diff options
author | Aylur <[email protected]> | 2024-10-10 15:11:46 +0000 |
---|---|---|
committer | Aylur <[email protected]> | 2024-10-10 15:11:46 +0000 |
commit | 800af1021c67ffe0ddcaed37ab09179d33102e35 (patch) | |
tree | 0a676e552767d0b0fad9d3a89ae6a3bfc2e83664 /core/gjs/src/variable.ts | |
parent | 5d93852b4469bfbe9ef728b4f8db2f647d8a0952 (diff) |
docs: gobject, variable, binding page
Diffstat (limited to 'core/gjs/src/variable.ts')
-rw-r--r-- | core/gjs/src/variable.ts | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/core/gjs/src/variable.ts b/core/gjs/src/variable.ts index 8739ef6..b61e335 100644 --- a/core/gjs/src/variable.ts +++ b/core/gjs/src/variable.ts @@ -1,6 +1,6 @@ -import Binding, { type Connectable } from "./binding.js" +import Binding, { type Connectable, type Subscribable } from "./binding.js" import { Astal } from "./imports.js" -import { interval, idle } from "./time.js" +import { interval } from "./time.js" import { execAsync, subprocess } from "./process.js" class VariableWrapper<T> extends Function { @@ -200,10 +200,9 @@ class VariableWrapper<T> extends Function { } static derive< - const Deps extends Array<Variable<any> | Binding<any>>, + const Deps extends Array<Subscribable<any>>, Args extends { - [K in keyof Deps]: Deps[K] extends Variable<infer T> - ? T : Deps[K] extends Binding<infer T> ? T : never + [K in keyof Deps]: Deps[K] extends Subscribable<infer T> ? T : never }, V = Args, >(deps: Deps, fn: (...args: Args) => V = (...args) => args as unknown as V) { @@ -225,7 +224,7 @@ export const Variable = new Proxy(VariableWrapper as any, { }) as { derive: typeof VariableWrapper["derive"] <T>(init: T): Variable<T> - new <T>(init: T): Variable<T> + new<T>(init: T): Variable<T> } export default Variable |