Skip to content

Infinite Queries: errors when generating TypeScript declaration files #4879

@patrykszwed

Description

@patrykszwed

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 🙏🏼

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions