uppy icon indicating copy to clipboard operation
uppy copied to clipboard

Complete TypeScript support of our documented APIs

Open mifi opened this issue 1 year ago • 6 comments

Problem

It would be nice to have our types complete, but we're not quite there yet. I have collected some related issues about missing types:

Uppy

  • #4355
  • #3083
  • #3336
  • #4293
  • #4090
  • #4319

Companion

  • [ ] Companion options object #4355
  • [ ] Rewrite Companion to Typescript

TypeScript fixes

Update: We are in the process of migrating the codebase to typescript. But in the process we have taken some shortcuts, and in order to improve our type safety we should fix this.

  • [ ] Remove most usage of any
  • [ ] Remove most usage of as keyword (except as const)
  • [ ] Remove noImplicitAny: false from all tsconfig.json
  • [ ] Remove all @ts-ignore unless absolutely necessary
  • [ ] Remove all eslint ignore typescript rules unless absolutely necessary
  • [ ] Remove most usage of non-null assertion operator !
  • [ ] maybe use strict typescript config?
  • [ ] tsify private/dev project

https://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html

Solution

Maybe to keep issue count down, we can close all those above issues, and instead use this issue to track missing types. When people report missing types, we can add them here. Then someone who knows typescript well can take a few days to go through all the issues and implement them.

Alternatives

remove typescript support 🙊 (j/k)

mifi avatar Mar 17 '23 04:03 mifi

I think this is the right place to suggest adding typescript types for @uppy/locales, right?

dargmuesli avatar Apr 26 '23 11:04 dargmuesli

I think this is the right place to suggest adding typescript types for @uppy/locales, right?

BTW is this happening?

image

convers39 avatar May 23 '24 07:05 convers39

Uppy has been completely rewritten in TS. The new types are available on the @next tag of all packages.

Murderlon avatar May 23 '24 07:05 Murderlon

Uppy has been completely rewritten in TS. The new types are available on the @next tag of all packages.

@Murderlon thank you for your quick response. BTW where can I find those packages tagged with @next? Currently I use @uppy/core: 3.8.0 and @uppy/locales: 3.5.3

convers39 avatar May 23 '24 08:05 convers39

Looks like for locales there's v4.0.0-beta.1 and for core v4.0.0-beta.8

dargmuesli avatar May 23 '24 09:05 dargmuesli

All packages, normally installed like npm i @uppy/core @uppy/dashboard would now just be npm i @uppy/core@next @uppy/dashboard@next. There is no list of breaking changes or a migration guide but the beta is stable. Use with caution of course.

Murderlon avatar May 23 '24 12:05 Murderlon

v4 was just released and all types seem to work fine for me! Took a bit to find the migration guide on GitHub though, as the website did not update for me yet it appears.

dargmuesli avatar Jul 10 '24 22:07 dargmuesli

Thanks for the migration hint, website still not showing v4 guide

CanRau avatar Jul 11 '24 00:07 CanRau

Site didn't update automatically. Taking a look now.

Murderlon avatar Jul 11 '24 08:07 Murderlon