Closed JensForstmann closed 2 years ago
The path prop of the Route component is wrongly typed as path: string.
path
path: string
I'd expect it typed as path: string | string[] as in RouteDefinition.
path: string | string[]
RouteDefinition
Compare https://github.com/solidjs/solid-app-router/blob/d4de2f857894e1a534db6d6701e4b46db7e7d35b/src/components.tsx#L149-L150 to https://github.com/solidjs/solid-app-router/blob/d4de2f857894e1a534db6d6701e4b46db7e7d35b/src/types.ts#L56-L57
https://stackblitz.com/edit/vitejs-vite-ucupp1?file=src%2Fmain.tsx
import { render } from 'solid-js/web'; import { Router, Route, Routes } from "solid-app-router"; render( () => ( <Router> <Routes> <Route path="/" element={<></>} /> <Route path={["/", "/home"]} element={<></>} /> {/* <<-- Error here: Type 'string[]' is not assignable to type 'string'.*/} </Routes> </Router> ), document.getElementById('root') as HTMLElement );
No response
Fix got merged in #135
Describe the bug
The
path
prop of the Route component is wrongly typed aspath: string
.I'd expect it typed as
path: string | string[]
as inRouteDefinition
.Compare https://github.com/solidjs/solid-app-router/blob/d4de2f857894e1a534db6d6701e4b46db7e7d35b/src/components.tsx#L149-L150 to https://github.com/solidjs/solid-app-router/blob/d4de2f857894e1a534db6d6701e4b46db7e7d35b/src/types.ts#L56-L57
Your Example Website or App
https://stackblitz.com/edit/vitejs-vite-ucupp1?file=src%2Fmain.tsx
Steps to Reproduce the Bug or Issue
Expected behavior
I'd expect it typed as
path: string | string[]
as inRouteDefinition
.Screenshots or Videos
No response
Platform
Additional context
No response