diff --git a/packages/svelte/src/lib/createInertiaApp.ts b/packages/svelte/src/lib/createInertiaApp.ts index 26d269964..64ec754e4 100644 --- a/packages/svelte/src/lib/createInertiaApp.ts +++ b/packages/svelte/src/lib/createInertiaApp.ts @@ -3,20 +3,20 @@ import type { ComponentType } from 'svelte' import App from './components/App.svelte' import SSR, { type SSRProps } from './components/SSR.svelte' import store from './store' -import type { ComponentsResolver, ResolvedComponents } from './types' +import type { ComponentResolver, ResolvedComponent } from './types' type SvelteRenderResult = { html: string; head: string; css: { code: string } } type SSRComponent = ComponentType & { render: (props: SSRProps) => SvelteRenderResult } interface CreateInertiaAppProps { id?: string - resolve: ComponentsResolver + resolve: ComponentResolver setup: (props: { el: Element App: ComponentType props: { initialPage: Page - resolveComponent: ComponentsResolver + resolveComponent: ComponentResolver } }) => void | App progress?: @@ -59,7 +59,7 @@ export default async function createInertiaApp({ resolveComponent, swapComponent: async ({ component, page, preserveState }) => { store.update((current) => ({ - component: component as ResolvedComponents, + component: component as ResolvedComponent, page, key: preserveState ? current.key : Date.now(), })) diff --git a/packages/svelte/src/lib/store.ts b/packages/svelte/src/lib/store.ts index 36cf25a79..bcdc7cc2b 100644 --- a/packages/svelte/src/lib/store.ts +++ b/packages/svelte/src/lib/store.ts @@ -1,9 +1,9 @@ import type { Page } from '@inertiajs/core' import { writable } from 'svelte/store' -import type { ResolvedComponents } from './types' +import type { ResolvedComponent } from './types' interface Store { - component: ResolvedComponents | null + component: ResolvedComponent | null page: Page | null key?: number | null } diff --git a/packages/svelte/src/lib/types.ts b/packages/svelte/src/lib/types.ts index 585407937..147ee2901 100644 --- a/packages/svelte/src/lib/types.ts +++ b/packages/svelte/src/lib/types.ts @@ -1,8 +1,8 @@ import type { ComponentType } from 'svelte' -export type ComponentsResolver = (name: string) => ResolvedComponents | Promise +export type ComponentResolver = (name: string) => ResolvedComponent | Promise -export type ResolvedComponents = { +export type ResolvedComponent = { default?: ComponentType layout?: ComponentType }