-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed as not planned
Description
Describe the problem
Current mount
API returns Record<string, any>
/**
* 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`.
*
* @template {Record<string, any>} Props
* @template {Record<string, any>} Exports
* @param {ComponentType<SvelteComponent<Props>> | Component<Props, Exports, any>} component
* @param {MountOptions<Props>} options
* @returns {Exports}
*/
export function mount(component, options) {
return _mount(component, options);
}
For cases like wxt, app
has to be typed like this:
let app: Record<string, any>;
import { mount, unmount } from 'svelte';
import App from '../lib/App.svelte';
export default defineContentScript({
main: async (ctx) => {
let app: Record<string, any>;
createShadowRootUi(ctx, {
onMount: (uiContainer) => {
app = mount(App, { target: uiContainer });
},
onRemove: () => unmount(app),
}).then((ui) => ui.mount());
},
});
Describe the proposed solution
Provide a Mounted
type.
Importance
nice to have
Metadata
Metadata
Assignees
Labels
No labels