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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions packages/gatsby-link/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react"
import { NavigateFn, LinkProps } from "@reach/router" // These come from `@types/reach__router`
import { NavigateOptions, LinkProps } from "@reach/router" // These come from `@types/reach__router`

// eslint-disable-next-line @typescript-eslint/naming-convention
export interface GatsbyLinkProps<TState> extends LinkProps<TState> {
Expand Down Expand Up @@ -33,7 +33,10 @@ export class Link<TState> extends React.Component<
* Sometimes you need to navigate to pages programmatically, such as during form submissions. In these
* cases, `Link` won’t work.
*/
export const navigate: (...args: Parameters<NavigateFn>) => void;
export const navigate: {
(to: string, options?: NavigateOptions<{}>): void
(to: number): void
}
Comment on lines -36 to +39
Copy link
Contributor

Choose a reason for hiding this comment

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


/**
* It is common to host sites in a sub-directory of a site. Gatsby lets you set the path prefix for your site.
Expand Down