소스 검색

webcam,xhr-upload: Test and typing fixes

Renée Kooi 6 년 전
부모
커밋
71fba74014

+ 12 - 12
packages/@uppy/webcam/types/index.d.ts

@@ -1,25 +1,25 @@
 import Uppy = require('@uppy/core');
 
 declare module Webcam {
-    export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture';
+  export type WebcamMode = 'video-audio' | 'video-only' | 'audio-only' | 'picture';
 
-    export interface WebcamOptions extends Uppy.PluginOptions {
-        onBeforeSnapshot?: () => Promise<void>;
-        countdown?: number | boolean;
-        mirror?: boolean;
-        facingMode?: string;
-        modes: WebcamMode[];
-    }
+  export interface WebcamOptions extends Uppy.PluginOptions {
+    onBeforeSnapshot?: () => Promise<void>;
+    countdown?: number | boolean;
+    mirror?: boolean;
+    facingMode?: string;
+    modes: WebcamMode[];
+  }
 }
 
 declare class Webcam extends Uppy.Plugin {
-    constructor(uppy: Uppy.Uppy, opts: Partial<Webcam.WebcamOptions>);
+  constructor(uppy: Uppy.Uppy, opts: Partial<Webcam.WebcamOptions>);
 }
 
 export = Webcam;
 
 declare module '@uppy/core' {
-    export interface Uppy {
-        use(pluginClass: typeof Webcam, opts: Partial<Webcam.WebcamOptions>): Uppy.Uppy;
-    }
+  export interface Uppy {
+    use(pluginClass: typeof Webcam, opts: Partial<Webcam.WebcamOptions>): Uppy.Uppy;
+  }
 }

+ 8 - 0
packages/@uppy/webcam/types/webcam-tests.ts

@@ -0,0 +1,8 @@
+import Uppy = require('@uppy/core');
+import Webcam = require('../');
+
+{
+  Uppy().use(Webcam, {
+    modes: ['video-only']
+  });
+}

+ 11 - 11
packages/@uppy/xhr-upload/types/index.d.ts

@@ -2,27 +2,27 @@ import Uppy = require('@uppy/core');
 
 declare module XHRUpload {
   export interface XHRUploadOptions extends Uppy.PluginOptions {
-    limit: string;
-    bundle: boolean;
-    formData: FormData;
-    headers: any;
-    metaFields: string[];
-    fieldName: string;
-    timeout: number;
-    responseUrlFieldName: string;
+    limit?: number;
+    bundle?: boolean;
+    formData?: FormData;
+    headers?: any;
+    metaFields?: string[];
+    fieldName?: string;
+    timeout?: number;
+    responseUrlFieldName?: string;
     endpoint: string;
-    method: 'GET' | 'POST' | 'HEAD';
+    method?: 'GET' | 'POST' | 'PUT' | 'HEAD';
   }
 }
 
 declare class XHRUpload extends Uppy.Plugin {
-  constructor(uppy: Uppy.Uppy, opts: Partial<XHRUpload.XHRUploadOptions>);
+  constructor(uppy: Uppy.Uppy, opts: XHRUpload.XHRUploadOptions);
 }
 
 export = XHRUpload;
 
 declare module '@uppy/core' {
   export interface Uppy {
-    use(pluginClass: typeof XHRUpload, opts: Partial<XHRUpload.XHRUploadOptions>): Uppy.Uppy;
+    use(pluginClass: typeof XHRUpload, opts: XHRUpload.XHRUploadOptions): Uppy.Uppy;
   }
 }

+ 9 - 0
packages/@uppy/xhr-upload/types/xhr-upload-tests.ts

@@ -0,0 +1,9 @@
+import Uppy = require('@uppy/core');
+import XHRUpload = require('../');
+
+{
+  Uppy().use(XHRUpload, {
+    bundle: false,
+    endpoint: 'xyz'
+  } as XHRUpload.XHRUploadOptions);
+}