Closed spacepolice10 closed 7 months ago
Hi, I have a similar problem as @spacepolice10 Repo
For example in file ./src/atoms/quiz.ts
export const quizNameAtom = atom<string>(
get => get(quizAtom).data?.data.name ?? "Go Back"
);
export const quizLengthAtom = atom<number>(
get => get(quizAtom).data?.data.questions.length ?? 0
);
export const quizAtom = atomWithQuery(get => ({
queryKey: ["quiz", get(userNameAtom), get(quizSlugAtom)],
queryFn: () =>
api.get<QuizResponse>(
`/api/v1/Quiz/${get(userNameAtom)}/${get(quizSlugAtom)}`
),
}));
I get this errors
src/atoms/quiz.ts:21:10 - error TS2571: Object is of type 'unknown'.
21 get => get(quizAtom).data?.data.name ?? "Go Back"
~~~~~~~~~~~~~
src/atoms/quiz.ts:25:10 - error TS2571: Object is of type 'unknown'.
25 get => get(quizAtom).data?.data.questions.length ?? 0
~~~~~~~~~~~~~
Thank you so much for opening this issue, it saved me tons of time debugging :heart: :heart: :heart:
Let me know if its still broken.
It works now. Thanks.
Hi there, thank you for the great job done over this library
I found out that after updating to any versions newer than 0.8.1, VSCode and build tools (webpack, turbopack) say that type of atomWithQuery is
unknown
. Typescript doesn't help to provide correct typings related to Tanstack Query Core for some reason and Jotai itself can't handle such atoms usingget
&set
. I tried it on Next.js 14.1.0 with jotai-tanstack-query 0.8.3. Same thing happens on anyatomWithQuery
no matter what settings are passed to inner objects. Anything I can do about that. For now I just switched back to 0.8.1. and it runs fine. Thank you for any info in advance