[jszip] add string output type (#41183)

This commit is contained in:
Florian Keller
2020-01-08 16:51:31 +01:00
committed by Eloy Durán
parent e3e0ab9417
commit f1f2a7e50a
2 changed files with 9 additions and 2 deletions
+5 -2
View File
@@ -1,6 +1,8 @@
// Type definitions for JSZip 3.1
// Project: http://stuk.github.com/jszip/, https://github.com/stuk/jszip
// Definitions by: mzeiher <https://github.com/mzeiher>, forabi <https://github.com/forabi>
// Definitions by: mzeiher <https://github.com/mzeiher>
// forabi <https://github.com/forabi>
// Florian Keller <https://github.com/ffflorian>
// 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;
+4
View File
@@ -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<string>
folder.file("test.txt").async('text'); // $ExpectType Promise<string>
folder.file("test.txt").async('text').then((text: string) => {
if (text === "test string") {
log(SEVERITY.INFO, "all ok");