-
Notifications
You must be signed in to change notification settings - Fork 1
Typed base schema meta #17
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR introduces stronger TypeScript typings for the extension functions by parameterizing the schema metadata with a generic map of named types. It also adds a new "all" method to BaseSchemaMeta and updates the type signatures of schema wrapping helper functions.
Reviewed Changes
| File | Description |
|---|---|
| packages/extend/src/index.ts | Added generic type parameter for schema metadata, updated helper functions to use stricter typings, and introduced the "all" method for accessing schema types |
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
| typeof extension === "function" | ||
| ? extension({ | ||
| schema, | ||
| all(name) { |
Copilot
AI
Feb 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'all' method lacks an else branch to handle the case where 'getType(name as string)' does not match any of the known GraphQL type checks. Consider adding an error throw for unsupported types.
| }, | ||
| object(name) { | ||
| const graphQLType = getType(name); | ||
| const graphQLType = getType(name as string); |
Copilot
AI
Feb 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The repeated explicit cast 'name as string' might indicate that the 'getType' function's type signature could be refined to accept a more specific type, thereby reducing the need for such casts.
| const graphQLType = getType(name as string); | |
| const graphQLType = getType(name); |
6d919d5 to
f24d07d
Compare
f24d07d to
5f0c5e7
Compare
8c90521 to
646198e
Compare
5f0c5e7 to
a174199
Compare
646198e to
beb4055
Compare
e83658f to
b566ece
Compare
beb4055 to
af71214
Compare
b566ece to
56375be
Compare
4acd1ff to
bc4b76a
Compare
56375be to
83f17ec
Compare
bc4b76a to
a2c76c6
Compare
83f17ec to
1fcf347
Compare
a2c76c6 to
75dcde4
Compare
1fcf347 to
46d3bb5
Compare
75dcde4 to
b2c3899
Compare
4d52d81 to
d5e6cb9
Compare
858fd76 to
6c9b7bf
Compare
9e507e8 to
58b9bac
Compare
6c9b7bf to
c7fac30
Compare
84cf8f4 to
4e204ba
Compare
4e204ba to
51e9c60
Compare
51e9c60 to
33ad3b5
Compare
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Unsure if I want to ship this.
Big open question around the
allmethod:Typestype" behaviour so that it only accepts known type names?all? Other ideas:strictanynamed