Add "context" typing on SvelteComponent class

pull/6236/head
Mohammed Al qurafi 5 years ago
parent ec2540787a
commit a8eeb7fb7d

@ -104,6 +104,16 @@ export interface SvelteComponentDev {
$destroy(): void; $destroy(): void;
[accessor: string]: any; [accessor: string]: any;
} }
interface IComponentOptions {
target: Element;
anchor?: Element;
props?: Props;
context: Record<string, unknown>;
hydrate?: boolean;
intro?: boolean;
$$inline?: boolean;
}
/** /**
* Base class for Svelte components with some minor dev-enhancements. Used when dev=true. * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.
*/ */
@ -130,14 +140,7 @@ export class SvelteComponentDev extends SvelteComponent {
*/ */
$$slot_def: any; $$slot_def: any;
constructor(options: { constructor(options: IComponentOptions) {
target: Element;
anchor?: Element;
props?: Props;
hydrate?: boolean;
intro?: boolean;
$$inline?: boolean;
}) {
if (!options || (!options.target && !options.$$inline)) { if (!options || (!options.target && !options.$$inline)) {
throw new Error("'target' is a required option"); throw new Error("'target' is a required option");
} }
@ -229,14 +232,7 @@ export class SvelteComponentTyped<
*/ */
$$slot_def: Slots; $$slot_def: Slots;
constructor(options: { constructor(options: IComponentOptions) {
target: Element;
anchor?: Element;
props?: Props;
hydrate?: boolean;
intro?: boolean;
$$inline?: boolean;
}) {
super(options); super(options);
} }
} }

Loading…
Cancel
Save