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 error caused by wrong import in @uppy/provider-views #5584

Closed
2 tasks done
francisbourquestudyo opened this issue Jan 8, 2025 · 8 comments · Fixed by #5588
Closed
2 tasks done

Typescript error caused by wrong import in @uppy/provider-views #5584

francisbourquestudyo opened this issue Jan 8, 2025 · 8 comments · Fixed by #5588
Labels

Comments

@francisbourquestudyo
Copy link

francisbourquestudyo commented Jan 8, 2025

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

This new import in the @uppy/provider-views package introduces Typescript compilation errors. It should do an import from lib and not src. We are not importing the package explicitly, but it's probably a dependency for the dashboard or the React package.

The only solution for now is to have an override in our package.json setting the version to 4.3.0.

We already filled an issue a couple weeks ago for a similar issue in the @uppy/onedrive package.

Expected behavior

Project should build without any errors.

Actual behavior

Project builds with errors.

@francisbourquestudyo francisbourquestudyo changed the title Typescript error cased by wrong import in @uppy/provider-views Typescript error caused by wrong import in @uppy/provider-views Jan 8, 2025
@Xhale1
Copy link

Xhale1 commented Jan 9, 2025

I'm seeing a number of TypeScript errors as well when using the latest version of uppy. Mine seem to originate from Uppy core though I haven't dug too deep.

@Murderlon
Copy link
Member

Sorry this keeps happening because our editors auto-import something incorrectly 🙄

@joshuajung
Copy link

When importing Uppy Core into my TypeScript project via import Uppy from "@uppy/core", I am also seeing these errors:

 ERROR(TypeScript)  'err' is of type 'unknown'.
 FILE  /myrepo/node_modules/@uppy/core/src/Uppy.ts:902:14

    900 |       this.#restricter.validateSingleFile(file)
    901 |     } catch (err) {
  > 902 |       return err.message
        |              ^^^
    903 |     }
    904 |     return null
    905 |   }

 ERROR(TypeScript)  'err' is of type 'unknown'.
 FILE  /myrepo/node_modules/@uppy/core/src/Uppy.ts:914:14

    912 |       this.#restricter.validateAggregateRestrictions(existingFiles, files)
    913 |     } catch (err) {
  > 914 |       return err.message
        |              ^^^
    915 |     }
    916 |     return null
    917 |   }

May this be related to this issue, or a separate topic?

@Murderlon
Copy link
Member

Can you create a reproducible example in a new issue? Here are some links:

@joshuajung
Copy link

joshuajung commented Jan 9, 2025

I have created a reproducible example at https://stackblitz.com/edit/vitejs-vite-twyc9zzx.

It is based on Uppy React, just upgraded @uppy/core to 4.4.0 and @uppy/dashboard to 4.3.0 (the latter seems to be the culprit actually, sorry for being imprecise in my first message).

To see a bunch of TS errors for the ./src directory, including the two I mentioned above, simply stop Vite and run tsc in the terminal.

@Murderlon
Copy link
Member

I think it may be related after all. Putting out a new release now and testing your example afterwards.

@Murderlon
Copy link
Member

@joshuajung
Copy link

Awesome, the issues are gone for me locally as well. Thanks a lot for the super quick turnaround.

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

Successfully merging a pull request may close this issue.

4 participants