-
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
Rewrite gatsby-link in typescript #22027
Conversation
handleRef(ref: HTMLAnchorElement | null): void { | ||
if ( | ||
this.props.innerRef && | ||
Object.prototype.hasOwnProperty.call(this.props.innerRef, `current`) |
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.
why was this change necessary?
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.
|
@@ -173,48 +219,53 @@ class GatsbyLink extends React.Component { | |||
// loaded before continuing. | |||
navigate(to, { state, replace }) | |||
} | |||
|
|||
return true |
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.
Double checking this is an appropriate change. As I understand React doesn't respect any return values (typings also want a void method)
These are both restored, I've got some concerns about what the source of truth is. Proptypes, Typescript and the .d.ts all have a different understanding of the props. I can spend some time trying to converge them better, thoughts?
Babel will transpile happily but Typescript compiler is not happy. So the PR isn't mergeable until these are fixed The signature looks something like:
This would mean the code has to become |
We should absolutely aim to move to auto generating the typings. However at the moment we're compiling with Babel, so can't generate them as part of the compilation step. We'd need to either switch to compiling the package with tsc, or run it separately to generate the typings. |
I just saw this PR already attempts this. Sorry for duplicating this work in #22563 Note that I also remove index.d.ts but added a typings generation step to introduce a compatible one. Happy to work on this on either PR |
Hey! Thanks so much for opening this pull request! Sadly this PR got stale and didn't have any activity for some time. We're trying to do better with PR reviews! To get a better overview of all actionable PRs we're going through all open PRs and triage them. Since we won't be able to do everything and adding new features always means added maintenance burden, we have to be more picky about what's beneficial for the average user and the project itself longterm. We think this is a great PR and would love to see it land in Gatsby. We're closing this PR for now but if you're able to rebase onto the latest We absolutely want to have you as a contributor and are sorry for any inconveniences we caused with replying too late to this PR. Thanks for submitting to Gatsby! 💜 |
Description
Moves gatsby-link into the typescript world.
Related Issues
Related to #21995
TODO
@blainekasten can you provide some assistance, I have a few things I'm uncertain about:
index.d.ts
be deleted? As I understand this should now be autogenerated, with the typescript files being the source of truth now.Happy to keep working on it but if you have any suggestions let me know