#zodValidator in validateSeach causes useSearch to return any-type

23 messages · Page 1 of 1 (latest)

potent flume
#

zodValidator in validateSeach causes useSearch to return any-type

wispy fern
#

try Route.useSearch()

#

ah wait you're in another component

potent flume
jolly hearth
#

can you please provide a complete minimal example by forking one of the existing examples on Stackblitz?

potent flume
stable sand
clear wolf
#

ugg this started happening to me and I can't figure out why

jolly hearth
clear wolf
#

Yeah I can get a repo together for it

clear wolf
#

@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

GitHub

Contribute to jrnxf/x development by creating an account on GitHub.

jolly hearth
#

which route shows which kind of issue exactly?

clear wolf
#

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

jolly hearth
#

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>;
   };
 }
clear wolf
#

I literally just noticed RIP

jolly hearth
#

module augmentation only works for interfaces

clear wolf
#

I had an eslint plugin that made all my interfaces types and missed this

jolly hearth
#

is this wrong in the docs somewhere?

#

oh

clear wolf
#

sorry for the false alarm!!

jolly hearth
#

no problem

clear wolf
#
      "@typescript-eslint/consistent-type-definitions": ["error", "type"],

was my issue :/