projects/, projects/1234, and projects/edit/1234 should be equally valid. But as seen in the error logs below, tsc requires that the ProjectsPage route have an id param. I'm pretty sure that param is the wrong type too, (string | number)[] is too narrow when string and number should also be valid.
Paste all your error logs here:
app/core/layouts/AppLayout.tsx:23:45 - error TS2554: Expected 1 arguments, but got 0.
23 () => router.pathname.startsWith(Routes.ProjectsPage().pathname),
~~~~~~~~~~~~
node_modules/.blitz/index.d.ts:7:14
7 ProjectsPage(query: { id?: (string | number)[] } & ParsedUrlQueryInput): RouteUrlObject;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An argument for 'query' was not provided.
app/core/layouts/AppLayout.tsx:35:30 - error TS2554: Expected 1 arguments, but got 0.
35 <Link href={Routes.ProjectsPage()}>
~~~~~~~~~~~~
node_modules/.blitz/index.d.ts:7:14
7 ProjectsPage(query: { id?: (string | number)[] } & ParsedUrlQueryInput): RouteUrlObject;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An argument for 'query' was not provided.
app/projects/components/EditProject.tsx:95:27 - error TS2554: Expected 1 arguments, but got 0.
95 router.replace(Routes.ProjectsPage())
~~~~~~~~~~~~
node_modules/.blitz/index.d.ts:7:14
7 ProjectsPage(query: { id?: (string | number)[] } & ParsedUrlQueryInput): RouteUrlObject;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An argument for 'query' was not provided.
app/projects/components/Project.tsx:161:47 - error TS2322: Type 'number' is not assignable to type '(string | number)[] | undefined'.
161 <Link href={Routes.ProjectsPage({ id })} replace>
~~
node_modules/.blitz/index.d.ts:7:23
7 ProjectsPage(query: { id?: (string | number)[] } & ParsedUrlQueryInput): RouteUrlObject;
~~
The expected type comes from property 'id' which is declared here on type '{ id?: (string | number)[] | undefined; } & ParsedUrlQueryInput'
What is the problem?
For a route like this:
projects/
,projects/1234
, andprojects/edit/1234
should be equally valid. But as seen in the error logs below, tsc requires that the ProjectsPage route have an id param. I'm pretty sure that param is the wrong type too,(string | number)[]
is too narrow whenstring
andnumber
should also be valid.Paste all your error logs here:
Paste all relevant code snippets here:
What are detailed steps to reproduce this?
1.
Run
blitz -v
and paste the output here:Please include below any other applicable logs and screenshots that show your problem:
No response