Access path params in head function
For some reason accessing path params in my head function, in order to set the title, causes weird TS errors. If I remove the quotes, to this
title: params.slug,
I get this error on the head function
'head' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions.ts(7023)I should also mention, this fails as well which creates this error on the loader
Type '({ params }: LoaderFnContext<Register, RootRoute<Register, undefined, {}, AnyContext, AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, ... 7 more ..., undefined>) => Promise<...>' is not assignable to type '(ctx: LoaderFnContext<Register, RootRoute<Register, undefined, {}, AnyContext, AnyContext, {}, undefined, unknown, unknown, unknown, unknown, undefined>, ... 7 more ..., undefined>) => never'. Type 'Promise<{ slug: string; post: { content: string; }; }>' is not assignable to type 'never'.ts(2322)

1 Reply
fair-roseOP•2mo ago
oops - looks like this is a known issue
https://github.com/TanStack/router/issues/5235
GitHub
Start RC -
lazyFn for loader with head results in type error ...Which project does this relate to? Router Describe the bug After upgrading to RC I've seen this type error that was working fine before the upgrade. Error: Type 'Promise<{ id: string; ti...