Skip to content

Commit

Permalink
fix(gatsby): add generic locationState to types (#24029)
Browse files Browse the repository at this point in the history
* add generic state to location

* Use WindowLocation["state"] as default location state

Co-authored-by: Matt Kane <m@mk.gg>

Co-authored-by: Matt Kane <m@mk.gg>
  • Loading branch information
antoinerousseau and ascorbic committed May 13, 2020
1 parent eff3cd8 commit 8f16846
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ export const prefetchPathname: (path: string) => void
* export default (props: IndexProps) => {
* ..
*/
export type PageProps<DataType = object, PageContextType = object> = {
export type PageProps<DataType = object, PageContextType = object, LocationState = WindowLocation["state"]> = {
/** The path for this current page */
path: string
/** The URI for the current page */
uri: string
/** An extended version of window.document which comes from @react/router */
location: WindowLocation
location: WindowLocation<LocationState>
/** A way to handle programmatically controlling navigation */
navigate: NavigateFn
/** You can't get passed children as this is the root user-land component */
Expand Down
1 change: 1 addition & 0 deletions packages/gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"@babel/cli": "^7.8.4",
"@babel/runtime": "^7.9.6",
"@types/hapi__joi": "^16.0.12",
"@types/reach__router": "^1.3.5",
"@types/socket.io": "^2.1.4",
"babel-preset-gatsby-package": "^0.4.1",
"cross-env": "^5.2.1",
Expand Down

0 comments on commit 8f16846

Please sign in to comment.