Skip to content

TS Type mismatch for components #329

@BusschaertTanguy

Description

@BusschaertTanguy

Hello,

I just started a brand new svelte project in vite, and have a type mismatch when defining routes with wrap.

I'm using Svelte 5, so maybe that's related.

This is the setup

<script lang="ts">
    import Router from "svelte-spa-router";
    import wrap from "svelte-spa-router/wrap";

    const routes: RouteDefinition= {
        '/products/': wrap({
            asyncComponent: () => import('./pages/products/Products.svelte'), // Error on asyncComponent
        })
    }
</script>

<Router routes={routes} />

image

This also applies for normal route definitions

<script lang="ts">
    import Router, {type RouteDefinition} from "svelte-spa-router";
    import Products from "./pages/products/Products.svelte";

    const routes: RouteDefinition = {
        '/products/': Products // Error on '/products'
    }
</script>

<Router routes={routes} />

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions