add extends to limit props type

pull/4577/head
Rongjian Zhang 6 years ago
parent 0ccd029033
commit 37a078d751

@ -98,14 +98,14 @@ export function validate_slots(name, slot, keys) {
} }
type Props = Record<string, any>; type Props = Record<string, any>;
export interface SvelteComponentDev<P = Props> { export interface SvelteComponentDev<P extends Props = Props> {
$set(props?: P): void; $set(props?: P): void;
$on<T = any>(event: string, callback: (event: CustomEvent<T>) => void): () => void; $on<T = any>(event: string, callback: (event: CustomEvent<T>) => void): () => void;
$destroy(): void; $destroy(): void;
[accessor: string]: any; [accessor: string]: any;
} }
export class SvelteComponentDev<P = Props> extends SvelteComponent { export class SvelteComponentDev<P extends Props = Props> extends SvelteComponent {
constructor(options: { constructor(options: {
target: Element; target: Element;
anchor?: Element; anchor?: Element;

Loading…
Cancel
Save