uppy/packages/@uppy/react/src
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
..
headless remove react h (#5938) 2025-08-29 16:24:16 +02:00
Dashboard.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
DashboardModal.ts Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
getHTMLProps.ts Use .js(x) for all imports instead .ts(x) (#5573) 2025-01-06 13:29:55 +01:00
index.ts @uppy/react: export useUppyContext (#6044) 2025-10-30 09:59:13 +01:00
nonHtmlPropsHaveChanged.ts Use .js(x) for all imports instead .ts(x) (#5573) 2025-01-06 13:29:55 +01:00
StatusBar.ts add back framework wrappers for @uppy/status-bar (#5948) 2025-09-17 10:40:57 +02:00
useDropzone.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useFileInput.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useRemoteSource.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useScreenCapture.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useUppyEvent.test.ts @uppy/utils: update export maps (#5900) 2025-08-19 12:25:27 +02:00
useUppyEvent.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useUppyState.test.tsx Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useUppyState.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
useWebcam.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00