uppy/packages/@uppy
Prakash 79e6460a6c
Make Generics Optional in uppy.getPlugin (#6057)
fixes #6024.

### Problem
- `getPlugin()` defaults to `UnknownPlugin`, so methods like `openModal`
are not visible , since core is not aware of that plugin type

### Proposed change
- Introduce a types-only registry in core:
- `export interface PluginTypeRegistry<M extends Meta, B extends Body>
{}`
- Overload `getPlugin` to return a precise type when the id is a known
key of the registry.
- add `Dashboard` to  PluginTypeRegistry through module augmentation:
  - `'Dashboard': Dashboard<M, B>`.
- When a project imports from `@uppy/dashboard`, its module augmentation
extends PluginTypeRegistry, adding the correct type into it
- I've added Tests , kept them in a separate file so it's easier to
review , once this approach gets approved I'll add them to
`Uppy.test.ts`

Once this PR gets a positive review I'll add this for other plugins ,
currently only added for `@uppy/dashboard`

**Build with Local tarball can be checked here** 


https://stackblitz.com/~/github.com/qxprakash/uppy-type-test?file=type_test.ts
2025-11-17 18:18:54 +05:30
..
angular [ci] release (#6029) 2025-10-28 10:15:14 +01:00
audio Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
aws-s3 Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
box Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
companion [ci] release (#6049) 2025-11-03 14:26:07 +01:00
companion-client [ci] release (#6011) 2025-10-17 20:24:52 +02:00
components [ci] release (#6029) 2025-10-28 10:15:14 +01:00
compressor Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
core Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
dashboard Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
drag-drop Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
drop-target Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
dropbox Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
facebook Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
form Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
golden-retriever Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
google-drive Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
google-drive-picker Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
google-photos-picker Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
image-editor Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
instagram Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
locales Revert "[ci] release (#5973)" 2025-09-26 11:30:56 +02:00
onedrive Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
provider-views @uppy/provider-views: add e2e tests for Server side search (#6015) 2025-11-07 16:50:57 +05:30
react Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
remote-sources Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
screen-capture Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
status-bar Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
store-default [ci] release (#5918) 2025-08-22 09:02:12 +02:00
svelte Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
thumbnail-generator Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
transloadit Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
tus Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
unsplash Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
url Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
utils Fix isNetworkError to match MDN spec: readyState === 4 && status === 0 (#6050) 2025-11-05 13:06:21 +08:00
vue Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
webcam Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
webdav Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
xhr-upload Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
zoom Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30