diff --git a/packages/svelte/types/index.d.ts b/packages/svelte/types/index.d.ts index 722872313a..363c05ed2a 100644 --- a/packages/svelte/types/index.d.ts +++ b/packages/svelte/types/index.d.ts @@ -379,26 +379,44 @@ declare module 'svelte' { }): Snippet; /** Anything except a function */ type NotFunction = T extends Function ? never : T; - /** - * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component. - * Transitions will play during the initial render unless the `intro` option is set to `false`. - * - * */ - export function mount, Exports extends Record>(component: ComponentType> | Component, options: {} extends Props ? { + export type MountOptions = Record> = { + /** + * Target element where the component will be mounted. + */ target: Document | Element | ShadowRoot; + /** + * Optional node inside `target` and when specified, it is used to render the component immediately before it. + */ anchor?: Node; - props?: Props; + /** + * Allows the specification of events. + */ events?: Record any>; + /** + * Used to define context at the component level. + */ context?: Map; + /** + * Used to control transition playback on initial render. The default value is `true` to run transitions. + */ intro?: boolean; + } & {} extends Props ? { + /** + * Component properties. + */ + props?: Props; } : { - target: Document | Element | ShadowRoot; + /** + * Component properties. + */ props: Props; - anchor?: Node; - events?: Record any>; - context?: Map; - intro?: boolean; - }): Exports; + } + /** + * Mounts a component to the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component. + * Transitions will play during the initial render unless the `intro` option is set to `false`. + * + * */ + export function mount, Exports extends Record>(component: ComponentType> | Component, options: MountOptions): Exports; /** * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component *