You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a query that's using instanceof to ensure that my API client is returning the expected type. The ESLint plugin is flagging this type as an unused dependency, even though that makes no sense.
Your minimal, reproducible example
Included in "Steps to reproduce"
Steps to reproduce
Note that this is using jotai-tanstack-query and this is all in TypeScript, but I assume that's irrelevant.
This reproduces the problem directly:
class SomeBaseResponse {}
class SomeResponse extends SomeBaseResponse {}
function someCall(): SomeBaseResponse {
return new SomeResponse();
}
export const someQuery = atomWithSuspenseQuery(() => ({
queryKey: ["someQuery"],
queryFn: () => {
const result = someCall();
if (result instanceof SomeResponse) {
return result;
}
throw new Error("Failed to get something");
}
}));
The ESLint plugin then gives the following error for the queryKey line:
error The following dependencies are missing in your queryKey: SomeResponse @tanstack/query/exhaustive-deps
Expected behavior
I'd expect the plugin to understand that the typename being used isn't a dependency and so not flag it.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
OS: macOS 14.4.1
Browser: Irrelevent
IDE: VSCode
Plugin versions:
"@tanstack/eslint-plugin-query": "^5.28.11",
"eslint": "^8.57.0",
Tanstack Query adapter
react-query
TanStack Query version
5.32.0
TypeScript version
5.4.5
Additional context
No response
The text was updated successfully, but these errors were encountered:
Describe the bug
I've got a query that's using
instanceof
to ensure that my API client is returning the expected type. The ESLint plugin is flagging this type as an unused dependency, even though that makes no sense.Your minimal, reproducible example
Included in "Steps to reproduce"
Steps to reproduce
Note that this is using
jotai-tanstack-query
and this is all in TypeScript, but I assume that's irrelevant.This reproduces the problem directly:
The ESLint plugin then gives the following error for the
queryKey
line:Expected behavior
I'd expect the plugin to understand that the typename being used isn't a dependency and so not flag it.
How often does this bug happen?
Every time
Screenshots or Videos
Platform
Tanstack Query adapter
react-query
TanStack Query version
5.32.0
TypeScript version
5.4.5
Additional context
No response
The text was updated successfully, but these errors were encountered: