[tus-js-client] Align definitions with v1.7 (#38891)

This commit is contained in:
LeSuisse
2019-10-07 16:49:04 -07:00
committed by Armando Aguirre
parent c3651a22cc
commit 28a2a403ca
2 changed files with 13 additions and 3 deletions
+5 -3
View File
@@ -1,8 +1,9 @@
// Type definitions for tus-js-client 1.5
// Type definitions for tus-js-client 1.7
// Project: https://github.com/tus/tus-js-client/
// Definitions by: Kevin Somers-Higgins <https://github.com/kevhiggins>
// Marius Kleidl <https://github.com/Acconut>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.2
export interface UploadOptions {
endpoint: string;
@@ -21,12 +22,13 @@ export interface UploadOptions {
overridePatchMethod?: boolean;
retryDelays?: number[];
removeFingerprintOnSuccess?: boolean;
uploadLengthDeferred?: boolean;
}
export class Upload {
constructor(file: File | Blob, options: UploadOptions);
constructor(file: File | Blob | Pick<ReadableStreamDefaultReader, "read">, options: UploadOptions);
file: File | Blob;
file: File | Blob | Pick<ReadableStreamDefaultReader, "read">;
options: UploadOptions;
url: string | null;
@@ -43,3 +43,11 @@ upload.abort();
const upload2 = new Tus.Upload(file, {
endpoint: ""
});
const reader = {
read: () => Promise.resolve({ done: true, value: '' }),
};
const upload3 = new Tus.Upload(reader, {
endpoint: '',
uploadLengthDeferred: true,
});