Loader types vs Route.useLoaderData() not matching
In Loader, type of userId is Id<'users'> or null.
In the AuthedLayout component userId is a type that looks like all the properties and methods on sting.
Any ideas what I'm doing wrong, my expectation is useLoaderData will be returning userId with type Id<'users'>

3 Replies
adverse-sapphire•3w ago
I just entered this section to ask the exact same thing. My Route.useLoaderData() is returning with Any types
dependent-tan•3w ago
@pj you would need to return
{userId} from beforeLoad to get the non-nullable type via context passed into the loader
@Guilherme Almeida this is a different issue. please open a new thread in #start-questions including a complete minimal reproducer projectadverse-sapphireOP•3w ago
Ah yes I had a memory of reading something like this in the docs after I posted so I'll dive back in today, thanks for the heads up