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

21
types/Icon/Icon.d.ts vendored
View file

@ -1,4 +1,5 @@
/// <reference types="svelte" />
import { SvelteComponent } from "svelte";
import { IconSkeletonProps } from "./IconSkeleton";
export interface IconProps extends IconSkeletonProps, svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["svg"]> {
@ -14,13 +15,13 @@ export interface IconProps extends IconSkeletonProps, svelte.JSX.HTMLAttributes<
skeleton?: boolean;
}
export default class Icon {
$$prop_def: IconProps;
$$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 Icon extends SvelteComponent<
IconProps,
{
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 IconSkeletonProps extends svelte.JSX.HTMLAttributes<HTMLElementTagNameMap["div"]> {
/**
@ -8,13 +9,13 @@ export interface IconSkeletonProps extends svelte.JSX.HTMLAttributes<HTMLElement
size?: number;
}
export default class IconSkeleton {
$$prop_def: IconSkeletonProps;
$$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 IconSkeleton extends SvelteComponent<
IconSkeletonProps,
{
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
},
{}
> {}