-
Hi there, I’m currently migrating to Pinia Colada from TanStack Query. In my current project, I’ve been managing query keys using the approach outlined in Query Key Factories. However, I encountered the following TypeScript warning while trying to use a similar pattern in Pinia Colada: import { useQuery } from "@pinia/colada";
const todoKeys = {
all: ["todos"] as const,
lists: () => [...todoKeys.all, "list"] as const,
// ...
};
function useTodosQuery() {
return useQuery({
// ...
key: todoKeys.lists(),
// Type 'readonly ["todos", "list"]' is not assignable to type 'MaybeRefOrGetter<EntryKey>'.
// The type 'readonly ["todos", "list"]' is 'readonly' and cannot be assigned to the mutable type 'EntryKey'.
});
} Could Pina Colada support const arrays directly, or would you recommend an alternative approach that works well with Pina Colada? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Yes, this should work despite the type error. It’s just that they aren’t typed as readonly (yet) |
Beta Was this translation helpful? Give feedback.
Yes, this should work despite the type error. It’s just that they aren’t typed as readonly (yet)