Skip to content

[TypeScript] Fetcher function doesn't respect array of keys types #331

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
enzoferey opened this issue Apr 6, 2020 · 2 comments
Closed

Comments

@enzoferey
Copy link

With a piece of code like:

const key = `some graphql query with variables`;
const entityId = 1;

const fetcher = (key: string, entityId: number) => { ... }

const { data } = useSWR([key, entityId], fetcher);

If you now inverse the arguments of fetcher, TypeScript doesn't report a type error even though it would be receiving the wrong parameters in runtime.

@enzoferey enzoferey changed the title [TypeScript Fetcher function doesn't respect array of keys types [TypeScript] Fetcher function doesn't respect array of keys types Apr 6, 2020
@crutch12
Copy link

crutch12 commented Aug 2, 2021

Bump
Any progress on this?

@shuding
Copy link
Member

shuding commented Sep 26, 2021

Fixed with #1477 🎉

@shuding shuding closed this as completed Sep 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants