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

TypeScript compilation errors after updating @uppy/onedrive to 4.1.2 #5559

Closed
2 tasks done
bourquep opened this issue Dec 20, 2024 · 5 comments · Fixed by #5573 or #5579
Closed
2 tasks done

TypeScript compilation errors after updating @uppy/onedrive to 4.1.2 #5559

bourquep opened this issue Dec 20, 2024 · 5 comments · Fixed by #5573 or #5579
Labels

Comments

@bourquep
Copy link

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

Our Vite/React project started failing to build after updating Uppy packages to their latest versions:

node_modules/@uppy/core/src/Uppy.ts:35:36 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

35 import supportsUploadProgress from './supportsUploadProgress.ts'
                                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@uppy/core/src/Uppy.ts:36:25 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

36 import getFileName from './getFileName.ts'
                           ~~~~~~~~~~~~~~~~~~

node_modules/@uppy/core/src/Uppy.ts:37:47 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

37 import { justErrorsLogger, debugLogger } from './loggers.ts'
                                                 ~~~~~~~~~~~~~~

node_modules/@uppy/core/src/Uppy.ts:42:8 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

42 } from './Restricter.ts'
          ~~~~~~~~~~~~~~~~~

node_modules/@uppy/core/src/Uppy.ts:46:20 - error TS5097: An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

46 import locale from './locale.ts'
                      ~~~~~~~~~~~~~

node_modules/@uppy/core/src/Uppy.ts:652:9 - error TS2578: Unused '@ts-expect-error' directive.

652         // @ts-expect-error these typed are inserted
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@uppy/core/src/Uppy.ts:902:14 - error TS18046: 'err' is of type 'unknown'.

902       return err.message
                 ~~~

node_modules/@uppy/core/src/Uppy.ts:914:14 - error TS18046: 'err' is of type 'unknown'.

914       return err.message
                 ~~~


Found 8 errors in the same file, starting at: node_modules/@uppy/core/src/Uppy.ts:35

It seemed odd that building our project would try to build TS files in node_modules/@uppy/core/src.

After downgrading each Uppy package individually until the build failure was resolved, we isolated the issue to @uppy/onedrive version 4.1.2. Being on the latest version of all @uppy packages but with onedrive 4.1.1 works fine.

It seems like this import might be the culprit:

https://github.com/transloadit/uppy/blob/main/packages/%40uppy/onedrive/src/OneDrive.tsx#L11

It imports from src and not lib.

This line was recently introduced in #5443, which was released as @uppy/onedrive version 4.1.2 (the faulty version).

Expected behavior

Project should build without any errors.

Actual behavior

Project builds with errors.

@bourquep bourquep added the Bug label Dec 20, 2024
@Murderlon
Copy link
Member

I can't reproduce this: https://stackblitz.com/edit/vitejs-vite-wl8bw5sv?file=main.ts%3AL21

Are you sure all Uppy packages are on latest? Have you tried removing node_modules and installing again?

To continue, I would need a reproducible example.

@bourquep
Copy link
Author

I forked your stackblitz and added a tsconfig.json. You can reproduce by running npx tsc.

https://stackblitz.com/edit/vitejs-vite-vkxbhewv

@Murderlon
Copy link
Member

Looking into this now.

@bourquep
Copy link
Author

bourquep commented Jan 6, 2025

The problem is still present with the latest packages released this morning. I'm not sure that you had to update all imports to use js instead of ts... AFAICT, this is the faulty line, which imports from src instead of lib:

https://github.com/transloadit/uppy/blob/main/packages/%40uppy/onedrive/src/OneDrive.tsx#L11

@Murderlon Murderlon reopened this Jan 7, 2025
@Murderlon
Copy link
Member

I thought I took that import along in the refactor but apparently missed out! Changing all the imports was for the better though as importing ts extensions can cause unexpected behavior too.

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