mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
@uppy/core: set default for Body generic (#5244)
* @uppy/core: set default for Body generic * Update angular example
This commit is contained in:
parent
9ff3746c83
commit
181ea6dfe8
3 changed files with 4 additions and 5 deletions
|
|
@ -65,8 +65,7 @@ export class AppComponent implements OnInit {
|
|||
},
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
uppy: Uppy<any, any> = new Uppy({ debug: true, autoProceed: true })
|
||||
uppy = new Uppy({ debug: true, autoProceed: true })
|
||||
|
||||
ngOnInit(): void {
|
||||
this.uppy
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ const defaultUploadState = {
|
|||
* Manages plugins, state updates, acts as an event bus,
|
||||
* adds/removes files and metadata.
|
||||
*/
|
||||
export class Uppy<M extends Meta, B extends Body> {
|
||||
export class Uppy<M extends Meta, B extends Body = Record<string, never>> {
|
||||
static VERSION = packageJson.version
|
||||
|
||||
#plugins: Record<string, UnknownPlugin<M, B>[]> = Object.create(null)
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@ class TestPlugin<M extends Meta, B extends Body> extends UIPlugin<Opts, M, B> {
|
|||
|
||||
test('can use Uppy class without generics', async () => {
|
||||
const core = new Uppy()
|
||||
expectTypeOf(core).toEqualTypeOf<Uppy<Meta, Body>>()
|
||||
expectTypeOf(core).toEqualTypeOf<Uppy<Meta, Record<string, never>>>()
|
||||
})
|
||||
|
||||
test('can .use() a plugin', async () => {
|
||||
const core = new Uppy().use(TestPlugin)
|
||||
expectTypeOf(core).toEqualTypeOf<Uppy<Meta, Body>>()
|
||||
expectTypeOf(core).toEqualTypeOf<Uppy<Meta, Record<string, never>>>()
|
||||
})
|
||||
|
||||
test('Meta and Body generic move through the Uppy class', async () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue