浏览代码

Fixed locale types thanks to feedback

Dirk-Jan Wassink 6 年之前
父节点
当前提交
9b0735d2c6
共有 1 个文件被更改,包括 11 次插入4 次删除
  1. 11 4
      packages/@uppy/core/types/index.d.ts

+ 11 - 4
packages/@uppy/core/types/index.d.ts

@@ -40,7 +40,9 @@ export interface FailedUppyFile<TMeta extends IndexedObject<any> = {}> extends U
 }
 
 export interface AddFileOptions extends Partial<UppyFile> {
-  // `.data` is the only required property here.
+  // `data` `name` and `type` are the only required properties here.
+  name: string;
+  type: string;
   data: Blob | File;
 }
 
@@ -70,9 +72,14 @@ export interface Store {
   subscribe(listener: any): () => void;
 }
 
-interface LocaleObject {
-  [key: string]: string | LocaleObject;
+interface LocaleStrings {
+  [key: string]: string | LocaleStrings;
 }
+interface Locale {
+  strings: LocaleStrings;
+  pluralize?: (n: number) => number;
+}
+
 export interface UppyOptions {
   id: string;
   autoProceed: boolean;
@@ -88,7 +95,7 @@ export interface UppyOptions {
   meta: any;
   onBeforeFileAdded: (currentFile: UppyFile, files: {[key: string]: UppyFile}) => UppyFile | boolean | undefined;
   onBeforeUpload: (files: {[key: string]: UppyFile}) => {[key: string]: UppyFile} | boolean;
-  locale: LocaleObject;
+  locale: Locale;
   store: Store;
 }