From f1f2a7e50a23e5317c7a5ae165fdb00bfbf1ae10 Mon Sep 17 00:00:00 2001 From: Florian Keller Date: Wed, 8 Jan 2020 16:51:31 +0100 Subject: [PATCH] [jszip] add string output type (#41183) --- types/jszip/index.d.ts | 7 +++++-- types/jszip/jszip-tests.ts | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/jszip/index.d.ts b/types/jszip/index.d.ts index 5f8b4e4afc..8034619de9 100644 --- a/types/jszip/index.d.ts +++ b/types/jszip/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for JSZip 3.1 // Project: http://stuk.github.com/jszip/, https://github.com/stuk/jszip -// Definitions by: mzeiher , forabi +// Definitions by: mzeiher +// forabi +// Florian Keller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -15,7 +17,7 @@ interface JSZipSupport { type Compression = 'STORE' | 'DEFLATE'; -interface Metadata { +interface Metadata { percent: number; currentFile: string; } @@ -37,6 +39,7 @@ interface InputByType { interface OutputByType { base64: string; text: string; + string: string; binarystring: string; array: number[]; uint8array: Uint8Array; diff --git a/types/jszip/jszip-tests.ts b/types/jszip/jszip-tests.ts index 0ea8c9b790..4d624d76b6 100644 --- a/types/jszip/jszip-tests.ts +++ b/types/jszip/jszip-tests.ts @@ -69,6 +69,10 @@ function testJSZip() { }).catch((e: any) => log(SEVERITY.ERROR, e)); const folder = newJszip.folder("test"); + + folder.file("test.txt").async('string'); // $ExpectType Promise + folder.file("test.txt").async('text'); // $ExpectType Promise + folder.file("test.txt").async('text').then((text: string) => { if (text === "test string") { log(SEVERITY.INFO, "all ok");