uppy/packages/@uppy/webcam/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
..
CameraIcon.tsx Run biome check on main (#5896) 2025-08-11 10:06:21 +02:00
CameraScreen.tsx lint fix 2025-08-21 14:34:12 +05:30
DiscardButton.tsx lint fix 2025-08-21 14:34:12 +05:30
formatSeconds.test.ts Use .js(x) for all imports instead .ts(x) (#5573) 2025-01-06 13:29:55 +01:00
formatSeconds.ts @uppy/webcam: refactor to TypeScript (#4870) 2024-03-11 15:30:03 +01:00
index.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
locale.ts @uppy/core: fix locale type for plugins (#5700) 2025-03-31 12:04:29 +02:00
PermissionsScreen.tsx lint fix 2025-08-21 14:34:12 +05:30
RecordButton.tsx lint fix 2025-08-21 14:34:12 +05:30
RecordingLength.tsx Run biome check on main (#5896) 2025-08-11 10:06:21 +02:00
SnapshotButton.tsx lint fix 2025-08-21 14:34:12 +05:30
style.scss Add stability warning comment to SCSS source files (#5960) 2025-09-11 21:53:40 +02:00
SubmitButton.tsx lint fix 2025-08-21 14:34:12 +05:30
supportsMediaRecorder.test.ts Migrate from Eslint/Prettier/Stylelint to Biome (#5794) 2025-07-01 14:55:41 +02:00
supportsMediaRecorder.ts From Babel to TS (#5792) 2025-06-30 16:12:26 +02:00
VideoSourceSelect.tsx Run biome check on main (#5896) 2025-08-11 10:06:21 +02:00
Webcam.test.ts Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30
Webcam.tsx Make Generics Optional in uppy.getPlugin (#6057) 2025-11-17 18:18:54 +05:30