@@ -305,6 +305,42 @@ declare module 'svelte' {
305305 : [ type : Type , parameter : EventMap [ Type ] , options ?: DispatchOptions ]
306306 ) : boolean ;
307307 }
308+
309+ /**
310+ * Defines the options accepted by the `mount()` function.
311+ */
312+ export type MountOptions < Props extends Record < string , any > = Record < string , any > > = {
313+ /**
314+ * Target element where the component will be mounted.
315+ */
316+ target : Document | Element | ShadowRoot ;
317+ /**
318+ * Optional node inside `target` and when specified, it is used to render the component immediately before it.
319+ */
320+ anchor ?: Node ;
321+ /**
322+ * Allows the specification of events.
323+ */
324+ events ?: Record < string , ( e : any ) => any > ;
325+ /**
326+ * Used to define context at the component level.
327+ */
328+ context ?: Map < any , any > ;
329+ /**
330+ * Used to control transition playback on initial render. The default value is `true` to run transitions.
331+ */
332+ intro ?: boolean ;
333+ } & ( { } extends Props ? {
334+ /**
335+ * Component properties.
336+ */
337+ props ?: Props ;
338+ } : {
339+ /**
340+ * Component properties.
341+ */
342+ props : Props ;
343+ } )
308344 /**
309345 * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.
310346 * It must be called during the component's initialisation (but doesn't need to live *inside* the component;
@@ -384,21 +420,7 @@ declare module 'svelte' {
384420 * Transitions will play during the initial render unless the `intro` option is set to `false`.
385421 *
386422 * */
387- export function mount < Props extends Record < string , any > , Exports extends Record < string , any > > ( component : ComponentType < SvelteComponent < Props > > | Component < Props , Exports , any > , options : { } extends Props ? {
388- target : Document | Element | ShadowRoot ;
389- anchor ?: Node ;
390- props ?: Props ;
391- events ?: Record < string , ( e : any ) => any > ;
392- context ?: Map < any , any > ;
393- intro ?: boolean ;
394- } : {
395- target : Document | Element | ShadowRoot ;
396- props : Props ;
397- anchor ?: Node ;
398- events ?: Record < string , ( e : any ) => any > ;
399- context ?: Map < any , any > ;
400- intro ?: boolean ;
401- } ) : Exports ;
423+ export function mount < Props extends Record < string , any > , Exports extends Record < string , any > > ( component : ComponentType < SvelteComponent < Props > > | Component < Props , Exports , any > , options : MountOptions < Props > ) : Exports ;
402424 /**
403425 * Hydrates a component on the given target and returns the exports and potentially the props (if compiled with `accessors: true`) of the component
404426 *
0 commit comments