Skip to content

fix: Types for extended loaders #5

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

Merged

Conversation

imp-dance
Copy link
Collaborator

  • Extended loaders now have correct types

Previously, if you extended a loader without providing a transform function, the extended loader would incorrectly inherit the return type from the original loader, instead of the extended queries. Using transform in either one also messed with the types which resulted in having to do the following workaround:

const loaderA = createLoader({
   queries: () => [useGetPokemon()],
});

const loaderB = loaderA.extend({
   queries: () => [useGetUser()],
   transform: (q) => q, // this line is no longer needed to get correct types
})

This should make using a baseLoader with common loading/error-handling throughout your application a bit less cumbersome to work with.

@imp-dance imp-dance linked an issue Nov 25, 2022 that may be closed by this pull request
@imp-dance imp-dance merged commit 716f411 into main Nov 25, 2022
@imp-dance imp-dance deleted the 2-types-are-wrong-in-extended-loader-in-certain-situations branch November 25, 2022 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Types are wrong in extended loader in certain situations
1 participant