Browse Source

uppy/image-editor: Fix TypeScript error in image-editor types (#4334)

Fix TypeScript error in image-editor types

Caused by TypeScript >= 4.8.
Matthias Kunnen 2 years ago
parent
commit
7bb3050641
1 changed files with 5 additions and 5 deletions
  1. 5 5
      packages/@uppy/image-editor/types/index.d.ts

+ 5 - 5
packages/@uppy/image-editor/types/index.d.ts

@@ -1,4 +1,4 @@
-import type { PluginOptions, UIPlugin, PluginTarget, UppyFile } from '@uppy/core'
+import type { PluginOptions, UIPlugin, PluginTarget, UppyFile, IndexedObject } from '@uppy/core'
 import type Cropper from 'cropperjs'
 import ImageEditorLocale from './generatedLocale'
 
@@ -32,12 +32,12 @@ export default ImageEditor
 
 // Events
 
-export type FileEditorStartCallback<TMeta> = (file: UppyFile<TMeta>) => void;
-export type FileEditorCompleteCallback<TMeta> = (updatedFile: UppyFile<TMeta>) => void;
-export type FileEditorCancelCallback<TMeta> = (file: UppyFile<TMeta>) => void;
+export type FileEditorStartCallback<TMeta extends IndexedObject<any>> = (file: UppyFile<TMeta>) => void;
+export type FileEditorCompleteCallback<TMeta extends IndexedObject<any>> = (updatedFile: UppyFile<TMeta>) => void;
+export type FileEditorCancelCallback<TMeta extends IndexedObject<any>> = (file: UppyFile<TMeta>) => void;
 
 declare module '@uppy/core' {
-  export interface UppyEventMap<TMeta> {
+  export interface UppyEventMap<TMeta extends IndexedObject<any>> {
     'file-editor:start' : FileEditorStartCallback<TMeta>
     'file-editor:complete': FileEditorCompleteCallback<TMeta>
     'file-editor:cancel': FileEditorCancelCallback<TMeta>