mirror of
https://github.com/zoriya/astal.git
synced 2026-06-02 10:15:14 +00:00
improve ts types
This commit is contained in:
+4
-2
@@ -175,10 +175,12 @@ type BindableProps<T> = {
|
||||
export type ConstructProps<
|
||||
Self extends { new(...args: any[]): any },
|
||||
Props = unknown,
|
||||
Signals = unknown
|
||||
Signals extends Record<string, Array<unknown>> = Record<string, []>
|
||||
> = {
|
||||
[Key in `on${string}`]: (self: Widget<Self>) => unknown
|
||||
} & Partial<Signals> & BindableProps<Props & {
|
||||
} & Partial<{
|
||||
[sig in keyof Signals]: (self: Widget<Self>, ...args: Signals[sig]) => unknown
|
||||
}> & BindableProps<Props & {
|
||||
className?: string
|
||||
css?: string
|
||||
cursor?: string
|
||||
|
||||
+3
-3
@@ -1,8 +1,8 @@
|
||||
/* eslint-disable max-len */
|
||||
import { Astal, Gtk } from "./imports.js"
|
||||
import astalify, { type ConstructProps, type Widget } from "./astalify.js"
|
||||
import astalify, { type ConstructProps } from "./astalify.js"
|
||||
|
||||
export { astalify }
|
||||
export { astalify, ConstructProps }
|
||||
|
||||
// Label
|
||||
export const Label = astalify<typeof Gtk.Label, LabelProps, "Label">(Gtk.Label)
|
||||
@@ -15,7 +15,7 @@ export type IconProps = ConstructProps<typeof Astal.Icon, Astal.Icon.Constructor
|
||||
// Button
|
||||
export const Button = astalify<typeof Astal.Button, ButtonProps, "Button">(Astal.Button)
|
||||
export type ButtonProps = ConstructProps<typeof Astal.Button, Astal.Button.ConstructorProperties, {
|
||||
onClicked: (self: Widget<typeof Astal.Button>) => void
|
||||
onClicked: []
|
||||
}>
|
||||
|
||||
// Window
|
||||
|
||||
@@ -170,10 +170,12 @@ type BindableProps<T> = {
|
||||
export type ConstructProps<
|
||||
Self extends { new(...args: any[]): any },
|
||||
Props = unknown,
|
||||
Signals = unknown
|
||||
Signals extends Record<string, Array<unknown>> = Record<string, []>
|
||||
> = {
|
||||
[Key in `on${string}`]: (self: Widget<Self>) => unknown
|
||||
} & Partial<Signals> & BindableProps<Props & {
|
||||
} & Partial<{
|
||||
[sig in keyof Signals]: (self: Widget<Self>, ...args: Signals[sig]) => unknown
|
||||
}> & BindableProps<Props & {
|
||||
className?: string
|
||||
css?: string
|
||||
cursor?: string
|
||||
|
||||
+3
-3
@@ -1,10 +1,10 @@
|
||||
/* eslint-disable max-len */
|
||||
import { Astal, Gtk } from "./imports.js"
|
||||
import astalify, { type ConstructProps, type Widget } from "./astalify.js"
|
||||
import astalify, { type ConstructProps } from "./astalify.js"
|
||||
import type GtkT from "@girs/node-gtk-3.0/node-gtk-3.0"
|
||||
import type AstalT from "@girs/node-astal-0.1/node-astal-0.1"
|
||||
|
||||
export { astalify }
|
||||
export { astalify, ConstructProps }
|
||||
|
||||
// Label
|
||||
export const Label = astalify<typeof Gtk.Label, LabelProps, "Label">(Gtk.Label)
|
||||
@@ -17,7 +17,7 @@ export type IconProps = ConstructProps<typeof Astal.Icon, AstalT.Icon.Constructo
|
||||
// Button
|
||||
export const Button = astalify<typeof Astal.Button, ButtonProps, "Button">(Astal.Button)
|
||||
export type ButtonProps = ConstructProps<typeof Astal.Button, AstalT.Button.ConstructorProperties, {
|
||||
onClicked: (self: Widget<typeof Astal.Button>) => void
|
||||
onClicked: []
|
||||
}>
|
||||
|
||||
// Window
|
||||
|
||||
Reference in New Issue
Block a user