-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
chore(gatsby): add Offer a base Page props type which folks can extend #21542
Conversation
We should be able to safely remove this.
This is an object that holds info about what the page dependencies are, component, data, ... This should have a fixed type
|
Updated - thanks! |
Co-Authored-By: Ward Peeters <[email protected]>
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.
LGTM! Thanks @orta!
Fixed in |
* Update WrapPageElement*Args interface PR #21542 introduced a new type PageProps which can also be used on WrapPageElement*Args interfaces. * Add generics for data and context
Description
Once I started using shared fragments, all the auto-generate types tooling broke, so I went manual.
I started using this type in TypeScript v2 and figured it'd be better that I give it to Gatsby instead. Effectively gives people a base type to build on top of for describing the data in their
This is how I define my types which have both a query and custom context from
createPage
.( and yah yah,
lang
vslangKey
- I couldn't find docs onlangKey
so I just used my own everywhere)Documentation
When there's official TS docs, this should go in as a way to describe your own props - I included a bunch of examples inline which you can copy & paste later
Discussion
I do not know what these are/do:
"*"
could be on the props, but I included it because it was on the older one (it doesn't show up in any of my props at runtime)pageResources
- I don't get what this does, and couldn't figure it out from some googling and reading docs - so I didn't document it and left it ambiguous but there