fix: update type of `options.target` (#10892)

pull/10895/head
Rich Harris 1 year ago committed by GitHub
parent 1fc5f8b9c0
commit 8214075285
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: update type of `options.target`

@ -105,7 +105,7 @@ export function createRoot() {
* @template {Record<string, any>} Events
* @param {import('../../main/public.js').ComponentType<import('../../main/public.js').SvelteComponent<Props, Events>>} component
* @param {{
* target: Node;
* target: Document | Element | ShadowRoot;
* props?: Props;
* events?: { [Property in keyof Events]: (e: Events[Property]) => any };
* context?: Map<any, any>;
@ -127,7 +127,7 @@ export function mount(component, options) {
* @template {Record<string, any>} Events
* @param {import('../../main/public.js').ComponentType<import('../../main/public.js').SvelteComponent<Props, Events>>} component
* @param {{
* target: Node;
* target: Document | Element | ShadowRoot;
* props?: Props;
* events?: { [Property in keyof Events]: (e: Events[Property]) => any };
* context?: Map<any, any>;
@ -190,7 +190,7 @@ export function hydrate(component, options) {
* @template {Record<string, any>} Events
* @param {import('../../main/public.js').ComponentType<import('../../main/public.js').SvelteComponent<Props, Events>>} Component
* @param {{
* target: Node;
* target: Document | Element | ShadowRoot;
* anchor: null | Text;
* props?: Props;
* events?: { [Property in keyof Events]: (e: Events[Property]) => any };

@ -105,7 +105,7 @@ const newComponentEvents2: ComponentEvents<NewComponent> = {
};
mount(NewComponent, {
target: null as any as Document | Element | ShadowRoot | Text | Comment,
target: null as any as Document | Element | ShadowRoot,
props: {
prop: 'foo',
// @ts-expect-error
@ -120,7 +120,7 @@ mount(NewComponent, {
});
hydrate(NewComponent, {
target: null as any as Document | Element | ShadowRoot | Text | Comment,
target: null as any as Document | Element | ShadowRoot,
props: {
prop: 'foo',
// @ts-expect-error

@ -300,7 +300,7 @@ declare module 'svelte' {
*
* */
export function mount<Props extends Record<string, any>, Exports extends Record<string, any>, Events extends Record<string, any>>(component: ComponentType<SvelteComponent<Props, Events, any>>, options: {
target: Node;
target: Document | Element | ShadowRoot;
props?: Props | undefined;
events?: { [Property in keyof Events]: (e: Events[Property]) => any; } | undefined;
context?: Map<any, any> | undefined;
@ -311,7 +311,7 @@ declare module 'svelte' {
*
* */
export function hydrate<Props extends Record<string, any>, Exports extends Record<string, any>, Events extends Record<string, any>>(component: ComponentType<SvelteComponent<Props, Events, any>>, options: {
target: Node;
target: Document | Element | ShadowRoot;
props?: Props | undefined;
events?: { [Property in keyof Events]: (e: Events[Property]) => any; } | undefined;
context?: Map<any, any> | undefined;

Loading…
Cancel
Save