refactor(types): use typed SvelteComponent interface for typing components

This commit is contained in:
Eric Liu 2020-11-25 15:29:55 -08:00
commit dab82d3479
156 changed files with 1379 additions and 1667 deletions

View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
export interface InlineNotificationProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
@ -56,17 +57,14 @@ export interface InlineNotificationProps extends svelte.JSX.HTMLAttributes<HTMLE
iconDescription?: string;
}
export default class InlineNotification {
$$prop_def: InlineNotificationProps;
$$slot_def: {
default: {};
actions: {};
};
$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: "close", cb: (event: CustomEvent<any>) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class InlineNotification extends SvelteComponent<
InlineNotificationProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
close: CustomEvent<any>;
},
{ default: {}; actions: {} }
> {}

View file

@ -1,16 +1,15 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
export interface NotificationActionButtonProps {}
export default class NotificationActionButton {
$$prop_def: NotificationActionButtonProps;
$$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: string, cb: (event: Event) => void): () => void;
}
export default class NotificationActionButton extends SvelteComponent<
NotificationActionButtonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{ default: {} }
> {}

View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
export interface NotificationButtonProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["button"]> {
/**
@ -24,13 +25,13 @@ export interface NotificationButtonProps extends svelte.JSX.HTMLAttributes<HTMLE
iconDescription?: string;
}
export default class NotificationButton {
$$prop_def: NotificationButtonProps;
$$slot_def: {};
$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 NotificationButton extends SvelteComponent<
NotificationButtonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{}
> {}

View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
export interface NotificationIconProps {
/**
@ -20,9 +21,4 @@ export interface NotificationIconProps {
iconDescription?: string;
}
export default class NotificationIcon {
$$prop_def: NotificationIconProps;
$$slot_def: {};
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class NotificationIcon extends SvelteComponent<NotificationIconProps, {}, {}> {}

View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
export interface NotificationTextDetailsProps {
/**
@ -26,11 +27,8 @@ export interface NotificationTextDetailsProps {
caption?: string;
}
export default class NotificationTextDetails {
$$prop_def: NotificationTextDetailsProps;
$$slot_def: {
default: {};
};
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class NotificationTextDetails extends SvelteComponent<
NotificationTextDetailsProps,
{},
{ default: {} }
> {}

View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
export interface ToastNotificationProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
@ -62,16 +63,14 @@ export interface ToastNotificationProps extends svelte.JSX.HTMLAttributes<HTMLEl
hideCloseButton?: boolean;
}
export default class ToastNotification {
$$prop_def: ToastNotificationProps;
$$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: "close", cb: (event: CustomEvent<any>) => void): () => void;
$on(eventname: string, cb: (event: Event) => void): () => void;
}
export default class ToastNotification extends SvelteComponent<
ToastNotificationProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
close: CustomEvent<any>;
},
{ default: {} }
> {}