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

Errors in TypeScript definitions when installed with pnpm #5164

Open
2 tasks done
andersk opened this issue May 15, 2024 · 5 comments
Open
2 tasks done

Errors in TypeScript definitions when installed with pnpm #5164

andersk opened this issue May 15, 2024 · 5 comments
Labels

Comments

@andersk
Copy link

andersk commented May 15, 2024

Initial checklist

  • I understand this is a bug report and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Link to runnable example

No response

Steps to reproduce

From an empty directory:

$ pnpm i @uppy/core typescript
Packages: +11
+++++++++++
Progress: resolved 11, reused 11, downloaded 0, added 11, done

dependencies:
+ @uppy/core 3.11.3
+ typescript 5.4.5

Done in 1.2s

$ echo 'import "@uppy/core"' > test.ts

$ pnpm exec tsc test.ts

Expected behavior

No errors.

Actual behavior

Several errors:

node_modules/.pnpm/@uppy+core@3.11.3/node_modules/@uppy/utils/types/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Translator, EventManager, ProgressTimeout, internalRateLimitedQueue, canvasToBlob, dataURItoBlob, dataURItoFile, emitSocketProgress, findAllDOMElements, findDOMElement, generateFileID, getBytesRemaining, getETA, getFileNameAndExtension, getFileType, getFileTypeExtension, getSocketHost, getSpeed, getTimeStamp, isDOMElement, isObjectURL, isDragDropSupported, isPreviewSupported, isTouchDevice, prettyETA, secondsToTime, settle, toArray, AbortController, AbortSignal, getDroppedFiles, getTextDirection, NetworkError, exports, ErrorWithCause, InternalMetadata

1 declare module '@uppy/utils/lib/Translator' {
  ~~~~~~~

  node_modules/.pnpm/@uppy+utils@5.9.0/node_modules/@uppy/utils/types/index.d.ts:1:1
    1 declare module '@uppy/utils/lib/Translator' {
      ~~~~~~~
    Conflicts are in this file.

node_modules/.pnpm/@uppy+core@3.11.3/node_modules/@uppy/utils/types/index.d.ts:349:5 - error TS2374: Duplicate index signature for type 'string'.

349     [key: string]: T
        ~~~~~~~~~~~~~~~~

node_modules/.pnpm/@uppy+core@3.11.3/node_modules/@uppy/utils/types/index.d.ts:350:5 - error TS2374: Duplicate index signature for type 'number'.

350     [key: number]: T
        ~~~~~~~~~~~~~~~~

node_modules/.pnpm/@uppy+utils@5.9.0/node_modules/@uppy/utils/types/index.d.ts:1:1 - error TS6200: Definitions of the following identifiers conflict with those in another file: Translator, EventManager, ProgressTimeout, internalRateLimitedQueue, canvasToBlob, dataURItoBlob, dataURItoFile, emitSocketProgress, findAllDOMElements, findDOMElement, generateFileID, getBytesRemaining, getETA, getFileNameAndExtension, getFileType, getFileTypeExtension, getSocketHost, getSpeed, getTimeStamp, isDOMElement, isObjectURL, isDragDropSupported, isPreviewSupported, isTouchDevice, prettyETA, secondsToTime, settle, toArray, AbortController, AbortSignal, getDroppedFiles, getTextDirection, NetworkError, exports, ErrorWithCause, InternalMetadata

1 declare module '@uppy/utils/lib/Translator' {
  ~~~~~~~

  node_modules/.pnpm/@uppy+core@3.11.3/node_modules/@uppy/utils/types/index.d.ts:1:1
    1 declare module '@uppy/utils/lib/Translator' {
      ~~~~~~~
    Conflicts are in this file.

node_modules/.pnpm/@uppy+utils@5.9.0/node_modules/@uppy/utils/types/index.d.ts:54:13 - error TS2649: Cannot augment module 'RateLimitedQueue' with value exports because it resolves to a non-module entity.

54   namespace RateLimitedQueue {
               ~~~~~~~~~~~~~~~~

node_modules/.pnpm/@uppy+utils@5.9.0/node_modules/@uppy/utils/types/index.d.ts:349:5 - error TS2374: Duplicate index signature for type 'string'.

349     [key: string]: T
        ~~~~~~~~~~~~~~~~

node_modules/.pnpm/@uppy+utils@5.9.0/node_modules/@uppy/utils/types/index.d.ts:350:5 - error TS2374: Duplicate index signature for type 'number'.

350     [key: number]: T
        ~~~~~~~~~~~~~~~~


Found 7 errors in 2 files.

Errors  Files
     3  node_modules/.pnpm/@uppy+core@3.11.3/node_modules/@uppy/utils/types/index.d.ts:1
     4  node_modules/.pnpm/@uppy+utils@5.9.0/node_modules/@uppy/utils/types/index.d.ts:1
@andersk andersk added the Bug label May 15, 2024
@andersk andersk changed the title Errors in TypeScript definitions Errors in TypeScript definitions when installed with pnpm May 15, 2024
@mifi
Copy link
Contributor

mifi commented May 15, 2024

are you saying the same works with npm or yarn? that means that pnpm is doing something differently with the node_modules file structure (?)

@mifi
Copy link
Contributor

mifi commented May 15, 2024

hmm, it seems to be installing the modules inside node_modules/.pnpm/package_name instead of the normal node_modules/package_name

@aduh95
Copy link
Member

aduh95 commented May 15, 2024

@mifi it's unrelated to pnpm, the error reported are in the index.d.ts file.

@andersk interesting, it looks like those have been here for a long time and never were reported/noticed 🤔 FWIW we already have removed that file in the 4.x beta line, if you try with @uppy/core@next, you should not see those errors.

@aduh95
Copy link
Member

aduh95 commented May 15, 2024

To confirm, I was able to get rid of the error with the following:

$ pnpm i @uppy/core@next
Packages: +4 -4
++++----
Progress: resolved 11, reused 7, downloaded 4, added 4, done

dependencies:
- @uppy/core 3.11.3
+ @uppy/core 4.0.0-beta.7

Done in 3.6s
$ pnpm exec tsc --target es6 test.ts

One of the changes we made in the 4.x branch was to switch our source files to TS, as the manually curated .d.ts files was more likely to have mistakes in them. I'm not sure fixing given how close we are from releasing the 4.x branch.

@Murderlon
Copy link
Member

3.x should be in a good state for quite a while still as the vast majority of people are on it and will stay on it. Therefor I think we should fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants