#zodValidator in validateSeach causes useSearch to return any-type
23 messages · Page 1 of 1 (latest)
even with Route.useSearch() the type stays any
can you please provide a complete minimal example by forking one of the existing examples on Stackblitz?
hmm, weirdly it works when trying to reproduce it on stackblitz. i guess my problem is somewhere else
Did you ever figure out the issue on this? I am running into this.
I ended up just reimplementing the router again from scratch and I am no longer getting the issue. Not sure what the difference was. 🤷♂️
ugg this started happening to me and I can't figure out why
can you reproduce this in an example?
Yeah I can get a repo together for it
@jolly hearth here's a repo! I'm having a hard time seeing anything wrong with what I'm doing - it's a fairly small app so I can't imagine my types are that complex, but would love your eyes. I am thinking this might be a bug https://github.com/jrnxf/x
which route shows which kind of issue exactly?
try /routes/users - or just anywhere that uses useSearchParams
this feels really fishy to me, but in another app I went through the "build from scratch" section on tanstack and this exact file + same stored file in npm gives me no type errors - it doesn't seem to be bothered whereas this file is
thats the issue
diff --git a/src/router.tsx b/src/router.tsx
index 76ace0e..be322c7 100644
--- a/src/router.tsx
+++ b/src/router.tsx
@@ -27,7 +27,7 @@ export function createRouter() {
}
declare module "@tanstack/react-router" {
- type Register = {
+ interface Register {
router: ReturnType<typeof createRouter>;
};
}
I literally just noticed RIP
module augmentation only works for interfaces
I had an eslint plugin that made all my interfaces types and missed this
sorry for the false alarm!!
no problem
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
was my issue :/