// Copyright: Ankitects Pty Ltd and contributors // License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html /* eslint @typescript-eslint/no-explicit-any: "off", */ import type { SvelteComponent } from "svelte"; export interface DynamicSvelteComponent< T extends typeof SvelteComponent = typeof SvelteComponent, > { component: T; [k: string]: unknown; } export const dynamicComponent = < Comp extends typeof SvelteComponent, DefaultProps = NonNullable[0]["props"]>, >( component: Comp, ) => (props: Props): DynamicSvelteComponent & Props => { return { component, ...props }; };