gatsby-link 5.14.0 types broken
abemedia opened this issue · 4 comments
abemedia commented
Preliminary Checks
- This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/gatsbyjs/gatsby/issues
- This issue is not a question, feature request, RFC, or anything other than a bug report directly related to Gatsby. Please post those things in GitHub Discussions: https://github.com/gatsbyjs/gatsby/discussions
Description
Updating gatsby-link to 5.14.0 causes types to be broken. It appear's to be caused by #38590
See the kind of Typescript errors I'm receiving now:
src/pages/signup/billing.tsx:102:14 - error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
102 navigate('/signup/')
~~~~~~~~~~
See the file src/pages/redirect.tsx
in the reproduction link.
Reproduction Link
Steps to Reproduce
- Call
navigate
using a string
Expected Result
Type checks pass
Actual Result
Type checks fail with following error
Argument of type 'string' is not assignable to parameter of type 'number'.
Environment
System:
OS: macOS 15.0.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.11.0 - /var/folders/xh/ttknrcjs3tbfv99f83f454d40000gn/T/yarn--1731201934806-0.747145292822317/node
Yarn: 1.22.21 - /var/folders/xh/ttknrcjs3tbfv99f83f454d40000gn/T/yarn--1731201934806-0.747145292822317/yarn
npm: 10.9.0 - /usr/local/bin/npm
Browsers:
Chrome: 130.0.6723.117
Safari: 18.0.1
npmPackages:
gatsby: ^5.14.0 => 5.14.0
gatsby-plugin-babel-plugin-typescript-to-proptypes: ^1.0.5 => 1.0.5
gatsby-plugin-catch-links: ^5.14.0 => 5.14.0
gatsby-plugin-google-gtag: ^5.14.0 => 5.14.0
gatsby-plugin-image: ^3.14.0 => 3.14.0
gatsby-plugin-manifest: ^5.14.0 => 5.14.0
gatsby-plugin-offline: ^6.14.0 => 6.14.0
gatsby-plugin-perf-budgets: ^0.0.18 => 0.0.18
gatsby-plugin-robots-txt: ^1.8.0 => 1.8.0
gatsby-plugin-sass: ^6.14.0 => 6.14.0
gatsby-plugin-sharp: ^5.14.0 => 5.14.0
gatsby-plugin-sitemap: ^6.14.0 => 6.14.0
gatsby-plugin-webpack-bundle-analyser-v2: ^1.1.32 => 1.1.32
gatsby-remark-autolink-headers: ^6.14.0 => 6.14.0
gatsby-remark-external-links: ^0.0.4 => 0.0.4
gatsby-remark-images: ^7.14.0 => 7.14.0
gatsby-remark-smartypants: ^6.14.0 => 6.14.0
gatsby-remark-table-of-contents: ^2.0.0 => 2.0.0
gatsby-remark-vscode: ^3.3.1 => 3.3.1
gatsby-source-filesystem: ^5.14.0 => 5.14.0
gatsby-transformer-inline-svg: ^1.2.0 => 1.2.0
gatsby-transformer-remark: ^6.14.0 => 6.14.0
gatsby-transformer-sharp: ^5.14.0 => 5.14.0
gatsby-transformer-yaml: ^5.14.0 => 5.14.0
Config Flags
No response
Dihgg commented
Hi, adding a comment here to say I'm facing the EXACT same issue.
jasonqsong commented
same issue here
SebastianKoch27 commented
We have the same issue here as well
abemedia commented
For others getting impatient, I just added this to a .d.ts
file in my repo as a temporary workaround:
// Overwrite bad declaration from gatsby-link.
// TODO: Remove once https://github.com/gatsbyjs/gatsby/pull/39169 is merged.
declare module 'gatsby-link' {
import { NavigateOptions } from '@reach/router'
export const navigate: {
(to: string, options?: NavigateOptions<unknown>): void
(to: number, options?: undefined): void
}
}