mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-18 11:36:36 +00:00
refactor(types): use typed SvelteComponent interface for typing components
This commit is contained in:
parent
4226535338
commit
dab82d3479
156 changed files with 1379 additions and 1667 deletions
23
types/Button/Button.d.ts
vendored
23
types/Button/Button.d.ts
vendored
|
@ -1,4 +1,5 @@
|
|||
/// <reference types="svelte" />
|
||||
import { SvelteComponent } from "svelte";
|
||||
import { ButtonSkeletonProps } from "./ButtonSkeleton";
|
||||
|
||||
export interface ButtonProps
|
||||
|
@ -88,9 +89,15 @@ export interface ButtonProps
|
|||
ref?: null | HTMLAnchorElement | HTMLButtonElement;
|
||||
}
|
||||
|
||||
export default class Button {
|
||||
$$prop_def: ButtonProps;
|
||||
$$slot_def: {
|
||||
export default class Button extends SvelteComponent<
|
||||
ButtonProps,
|
||||
{
|
||||
click: WindowEventMap["click"];
|
||||
mouseover: WindowEventMap["mouseover"];
|
||||
mouseenter: WindowEventMap["mouseenter"];
|
||||
mouseleave: WindowEventMap["mouseleave"];
|
||||
},
|
||||
{
|
||||
default: {
|
||||
props: {
|
||||
role: "button";
|
||||
|
@ -102,11 +109,5 @@ export default class Button {
|
|||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
> {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue