How to type this case correctly? - TanStack