Closed rallets closed 1 month ago
If you add WrappedComponent
instead of '*'
?
@carbogninalberto Hi, thanks for the tip. It's doesn't help, because '*' was just a catch-all route, I forgot to remove it in the example, but it sent me in the right direction.
The problem I was facing was related to the type returned from wrap
, that it doesn't look to be a SvelteComponent
, that is the base class for a Svelte component.
I found the solution: I didn't notice wrap
didn't return a SvelteComponent
but instead a WrappedComponent
that Router
uses internally.
Hence I just modified my typings and everything works like a charm:
const routes: Record<'/blabla' | '*', typeof SvelteComponent<any> | WrappedComponent> = {
'/blabla': wrap({ component: DummyComponent, props: { aProp: true } }),
...
}
Hi, I'm trying to strongly type a route mapping, but when I wrap a component the type doesn't make VS Code typescript happy.
Any tips?