From ca74fb7ad016f9ceee3756a973baa2d87a8aa1d6 Mon Sep 17 00:00:00 2001 From: Aylur Date: Tue, 4 Jun 2024 23:05:41 +0200 Subject: small fixes * export Gdk * flatten jsx children --- node/src/application.ts | 2 +- node/src/astalify.ts | 15 ++++++++++----- node/src/imports.ts | 1 + node/src/index.ts | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'node/src') diff --git a/node/src/application.ts b/node/src/application.ts index 552f2a9..13a999c 100644 --- a/node/src/application.ts +++ b/node/src/application.ts @@ -2,7 +2,7 @@ import gi from "node-gtk" const Astal = gi.require("Astal", "0.1") type RequestHandler = { - (request: string, res: (response: string) => void): void + (request: string, res: (response: any) => void): void } type Config = Partial<{ diff --git a/node/src/astalify.ts b/node/src/astalify.ts index bae6cc7..9f83e71 100644 --- a/node/src/astalify.ts +++ b/node/src/astalify.ts @@ -167,14 +167,19 @@ type BindableProps = { [K in keyof T]: Binding> | T[K]; } +type SigHandler< + W extends { new(...args: any): Gtk.Widget }, + Args extends Array, +> = ((self: Widget, ...args: Args) => unknown) | string | string[] + export type ConstructProps< Self extends { new(...args: any[]): any }, Props = unknown, - Signals extends Record> = Record -> = { - [Key in `on${string}`]: (self: Widget) => unknown -} & Partial<{ - [sig in keyof Signals]: (self: Widget, ...args: Signals[sig]) => unknown + Signals extends Record<`on${string}`, Array> = Record<`on${string}`, any[]> +> = Partial<{ + [S in keyof Signals]: SigHandler +}> & Partial<{ + [Key in `on${string}`]: SigHandler }> & BindableProps