feat(core): convert MetaQuery and GraphQLQueryOptions to interfaces - #7531
Open
Bugrabugra wants to merge 1 commit into
Open
feat(core): convert MetaQuery and GraphQLQueryOptions to interfaces#7531Bugrabugra wants to merge 1 commit into
Bugrabugra wants to merge 1 commit into
Conversation
Both types were plain type aliases, which prevented consumers from
using TypeScript's declaration merging to extend MetaQuery with
app-specific fields (e.g. meta.queryParams read by custom data
providers). Converting them to interfaces is structurally identical
and fully backward compatible, but unlocks:
declare module "@refinedev/core" {
interface MetaQuery {
queryParams?: { _pull?: string };
}
}
Fixes refinedev#7527
🦋 Changeset detectedLatest commit: 43d4ed9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both types were plain type aliases, which prevented consumers from using TypeScript's declaration merging to extend MetaQuery with app-specific fields (e.g. meta.queryParams read by custom data providers). Converting them to interfaces is structurally identical and fully backward compatible, but unlocks:
Fixes #7527
PR Checklist
Bugs / Features
What is the current behavior?
MetaQueryandGraphQLQueryOptionsare plain type aliases. Because type aliases can't be extended via TypeScript's declaration merging, consumers have no way to add typed fields tometa(e.g.meta.queryParams, read by most custom data providers to build query strings). Every key onmetais typed asany, so typos and shape mismatches go uncaught.What is the new behavior?
Converted both to interfaces (
MetaQuery extends QueryBuilderOptions, GraphQLQueryOptions). This is structurally identical and fully backward compatible, but it unlocks declaration merging:...giving autocompletion/type-checking for custom
metafields across every hook (useTable,useShow,useList, etc.) without wrapper hooks or per-call-site casting.fixes #7527
Notes for reviewers
This is a type-only change with no behavioral difference, so I didn't add a new runtime test (the package has no type-level test infrastructure like
tsd/expectTypeOf). Verified instead by:pnpm build(incl..d.tsgeneration) passing with zero errors forcore,hasura,strapi-v4, andui-types(all packages that referenceMetaQuery/GraphQLQueryOptions)coretest suite: 122 files / 1213 tests passingtsc)