Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

PageRenderer missing from typings #11796

Closed
jariz opened this issue Feb 15, 2019 · 5 comments 路 Fixed by #11825
Closed

PageRenderer missing from typings #11796

jariz opened this issue Feb 15, 2019 · 5 comments 路 Fixed by #11825
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@jariz
Copy link
Contributor

jariz commented Feb 15, 2019

Description

The PageRenderer component is missing from the TS typings.

Steps to reproduce

import { PageRenderer } from 'gatsby'; // 馃毃 TS2305: Module has no exported member 'PageRenderer'.

Expected result

N/A

Actual result

N/A

Environment

N/A

@pieh pieh added the type: bug An issue or pull request relating to a bug in Gatsby label Feb 15, 2019
@pieh
Copy link
Contributor

pieh commented Feb 15, 2019

Would you be interested and adding those in https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/index.d.ts

For reference this is the component

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby/cache-dir/public-page-renderer-prod.js

So it only have location prop

@jariz
Copy link
Contributor Author

jariz commented Feb 15, 2019

Thanks. I'll file a PR shortly.

@pieh
Copy link
Contributor

pieh commented Feb 15, 2019

location should have normal Location shape (https://developer.mozilla.org/en-US/docs/Web/API/Location). We mark just pathname as required, but there is bunch of other optional fields that can be passed (and used by the referenced page template component), so if there is ready to use Location TS typing - this is what we should use.

@jariz
Copy link
Contributor Author

jariz commented Feb 15, 2019

reach-router exports a WindowLocation type which differs slightly from the default location object because it has a couple of historyjs-specific keys added to it (like 'state'), so I was figuring I'd use that - if that's OK.

@pieh
Copy link
Contributor

pieh commented Feb 16, 2019

Sure! This is very good catch. Even if it's unlikely that users would use @reach/router specific fields this is more future proof.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants