Hello everyone
I'm working on a project where I use URL to manage the state of a document by storing the ID in the search params and retrieve it using nextJs's useSearchParams hook. Typescript correctly recognizes it as string by default.
I plan on passing the ID to a function who's validators expect the variable to be the correct Document Id. Could anyone share the best pattern on how to properly cast or validate the search param so that it matches the expected type?