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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix type of navigate method #39169

Merged

Conversation

pajosieg
Copy link
Contributor

Description

The usage of the original navigation function type created problems when using spreaded parameters. Since the navigate implementation in gatsby does not have the same call signature as @reach/router anyways (the promise returned by @reach/router is ignored), it is easier to define our own interface than to overwrite the types from @reach/router.

Related Issues

Fixes #39158

The usage of the original navigation function type created problems when using spreaded parameters. Since the navigate implementation in gatsby does not have the same call signature as @reach/router anyways (the promise returned by @reach/router is ignored), it is easier to define our own interface than to overwrite the types from @reach/router.
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 26, 2024
@pajosieg pajosieg changed the title Fixes type of navigate method Fix type of navigate method Nov 27, 2024
@pajosieg
Copy link
Contributor Author

pajosieg commented Nov 27, 2024

@pieh does it matter that most tests fail? These are not related to the fix.

@abemedia
Copy link

Would love to see this merged as this is currently blocking me from updating Gatsby.

@serhalp serhalp self-assigned this Dec 16, 2024
@serhalp serhalp added the type: bug An issue or pull request relating to a bug in Gatsby label Dec 16, 2024
Copy link
Contributor

@serhalp serhalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for contributing a fix!

Comment on lines -36 to +39
export const navigate: (...args: Parameters<NavigateFn>) => void;
export const navigate: {
(to: string, options?: NavigateOptions<{}>): void
(to: number): void
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@serhalp serhalp added status: accepted and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Dec 16, 2024
@serhalp serhalp merged commit cddc252 into gatsbyjs:master Dec 17, 2024
30 of 35 checks passed
@pieh
Copy link
Contributor

pieh commented Dec 20, 2024

Published:

 - gatsby-link@5.14.1
 - gatsby@5.14.1

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

Successfully merging this pull request may close these issues.

gatsby-link 5.14.0 types broken
4 participants