feat(types): use the SvelteComponentTyped interface in the TypeScript definitions

This commit is contained in:
Eric Liu 2021-02-06 14:10:18 -08:00
commit a56c954af0
161 changed files with 6379 additions and 6362 deletions

View file

@ -1,6 +1,8 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface ContentSwitcherProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
export interface ContentSwitcherProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
* Set the selected index of the switch item
* @default 0
@ -19,16 +21,14 @@ export interface ContentSwitcherProps extends svelte.JSX.HTMLAttributes<HTMLElem
size?: "sm" | "xl";
}
export default class ContentSwitcher {
$$prop_def: ContentSwitcherProps;
$$slot_def: {
default: {};
};
$on(eventname: "change", cb: (event: CustomEvent<number>) => void): () => void;
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class ContentSwitcher extends SvelteComponentTyped<
ContentSwitcherProps,
{
change: CustomEvent<number>;
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{ default: {} }
> {}

View file

@ -1,6 +1,8 @@
/// <reference types="svelte" />
import { SvelteComponentTyped } from "svelte";
export interface SwitchProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> {
export interface SwitchProps
extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> {
/**
* Specify the switch text
* Alternatively, use the "text" slot (e.g., <span slot="text">...</span>)
@ -33,16 +35,14 @@ export interface SwitchProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNam
ref?: null | HTMLButtonElement;
}
export default class Switch {
$$prop_def: SwitchProps;
$$slot_def: {
default: {};
};
$on(eventname: "click", cb: (event: WindowEventMap["click"]) => void): () => void;
$on(eventname: "mouseover", cb: (event: WindowEventMap["mouseover"]) => void): () => void;
$on(eventname: "mouseenter", cb: (event: WindowEventMap["mouseenter"]) => void): () => void;
$on(eventname: "mouseleave", cb: (event: WindowEventMap["mouseleave"]) => void): () => void;
$on(eventname: "keydown", cb: (event: WindowEventMap["keydown"]) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class Switch extends SvelteComponentTyped<
SwitchProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
keydown: WindowEventMap["keydown"];
},
{ default: {} }
> {}