-
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
Fix type of navigate method #39169
Fix type of navigate method #39169
Conversation
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.
@pieh does it matter that most tests fail? These are not related to the fix. |
Would love to see this merged as this is currently blocking me from updating Gatsby. |
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. Thank you for contributing a fix!
export const navigate: (...args: Parameters<NavigateFn>) => void; | ||
export const navigate: { | ||
(to: string, options?: NavigateOptions<{}>): void | ||
(to: number): void | ||
} |
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.
Published:
|
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