From 28a2a403cae526469843d740c0fa63faa3f3d9f7 Mon Sep 17 00:00:00 2001 From: LeSuisse Date: Tue, 8 Oct 2019 01:49:04 +0200 Subject: [PATCH] [tus-js-client] Align definitions with v1.7 (#38891) --- types/tus-js-client/index.d.ts | 8 +++++--- types/tus-js-client/tus-js-client-tests.ts | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/types/tus-js-client/index.d.ts b/types/tus-js-client/index.d.ts index 4cbb34a818..7904c61781 100644 --- a/types/tus-js-client/index.d.ts +++ b/types/tus-js-client/index.d.ts @@ -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 // Marius Kleidl // 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, options: UploadOptions); - file: File | Blob; + file: File | Blob | Pick; options: UploadOptions; url: string | null; diff --git a/types/tus-js-client/tus-js-client-tests.ts b/types/tus-js-client/tus-js-client-tests.ts index 237f1df233..e4701fdba0 100644 --- a/types/tus-js-client/tus-js-client-tests.ts +++ b/types/tus-js-client/tus-js-client-tests.ts @@ -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, +});