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

Infinite Queries: errors when generating TypeScript declaration files #4879

Closed
patrykszwed opened this issue Mar 5, 2025 · 2 comments · Fixed by #4881
Closed

Infinite Queries: errors when generating TypeScript declaration files #4879

patrykszwed opened this issue Mar 5, 2025 · 2 comments · Fixed by #4881
Assignees
Labels
bug Something isn't working TypeScript

Comments

@patrykszwed
Copy link

patrykszwed commented Mar 5, 2025

When trying to generate declaration files for an app that uses infinite queries released in v2.6.0, some errors are thrown.

Reproduction
https://codesandbox.io/p/devbox/3skwg4?migrateFrom=yw7kg9

Steps to reproduce:

  1. Open the reproduction app
  2. Run pnpm run generate-types (that script uses tsup)

Expected behavior:
Declaration files are generated without any errors.

Current behavior:
Some errors are thrown when generating declaration files:

➜  workspace git:(main) ✗ pnpm run generate-types

> react-typescript@1.0.0 generate-types /project/workspace
> tsup ./lib/index.ts --dts-resolve --dts-only -d dist-lib --format esm,cjs

CLI Building entry: lib/index.ts
CLI Using tsconfig: tsconfig.json
CLI tsup v8.4.0
DTS Build start
src/api.ts(33,16): error TS4023: Exported variable 'useBerriesInfiniteQuery' has or is using name 'InfiniteData' from external module "/project/workspace/node_modules/.pnpm/@reduxjs+toolkit@2.6.0_react-redux@9.2.0_react@18.2.0/node_modules/@reduxjs/toolkit/dist/query/react/index" but cannot be named.
src/api.ts(33,16): error TS4023: Exported variable 'useBerriesInfiniteQuery' has or is using name 'UseInfiniteQuerySubscriptionOptions' from external module "/project/workspace/node_modules/.pnpm/@reduxjs+toolkit@2.6.0_react-redux@9.2.0_react@18.2.0/node_modules/@reduxjs/toolkit/dist/query/react/index" but cannot be named.

Error: error occurred in dts build
    at Worker.<anonymous> (/project/workspace/node_modules/.pnpm/tsup@8.4.0_typescript@5.7.3/node_modules/tsup/dist/index.js:1541:26)
    at Worker.emit (node:events:514:28)
    at MessagePort.<anonymous> (node:internal/worker:263:53)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:807:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28)
DTS Build error
 ELIFECYCLE  Command failed with exit code 1.

Possibly related issues:

Possibly related PRs:

The above issues and PRs might be related, I'm not positive though. If that's the case, sorry for a duplicate and feel free to close my issue.

PS: Thank you for implementing infinite queries, they seem work very well. I appreciate it 🙏🏼

@markerikson
Copy link
Collaborator

Out in https://github.com/reduxjs/redux-toolkit/releases/tag/v2.6.1 !

@patrykszwed
Copy link
Author

Awesome, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working TypeScript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants