From be4e21c6f1837ef592959b43c70c722356ce1db3 Mon Sep 17 00:00:00 2001 From: andrisarkameru Date: Wed, 7 Mar 2018 15:49:25 +0200 Subject: [PATCH] Updated types list in TS definition [ci skip] fixes #1026 --- types/index.d.ts | 4 ++-- types/xlsx-tests.ts | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 3c2bfe7..c0a951d 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -110,7 +110,7 @@ export interface DateNFOption { /** Options for read and readFile */ export interface ParsingOptions extends CommonOptions { /** Input data encoding */ - type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array'; + type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'; /** Default codepage */ codepage?: number; @@ -193,7 +193,7 @@ export interface ParsingOptions extends CommonOptions { /** Options for write and writeFile */ export interface WritingOptions extends CommonOptions { /** Output data encoding */ - type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array'; + type?: 'base64' | 'binary' | 'buffer' | 'file' | 'array' | 'string'; /** * Generate Shared String Table diff --git a/types/xlsx-tests.ts b/types/xlsx-tests.ts index 4681e33..9dfa100 100644 --- a/types/xlsx-tests.ts +++ b/types/xlsx-tests.ts @@ -50,6 +50,13 @@ XLSX.utils.book_append_sheet(newwb, aoa2, "AOA"); XLSX.utils.book_append_sheet(newwb, js2ws, "JSON"); const bstrxlsx: string = XLSX.write(newwb, {type: "binary", bookType: "xlsx" }); +const wb_1: XLSX.WorkBook = XLSX.read(XLSX.write(newwb, {type: "base64", bookType: "xlsx" }), {type: "base64"}); +const wb_2: XLSX.WorkBook = XLSX.read(XLSX.write(newwb, {type: "binary", bookType: "xlsx" }), {type: "binary"}); +const wb_3: XLSX.WorkBook = XLSX.read(XLSX.write(newwb, {type: "buffer", bookType: "xlsx" }), {type: "buffer"}); +const wb_4: XLSX.WorkBook = XLSX.read(XLSX.write(newwb, {type: "file", bookType: "xlsx" }), {type: "file"}); +const wb_5: XLSX.WorkBook = XLSX.read(XLSX.write(newwb, {type: "array", bookType: "xlsx" }), {type: "array"}); +const wb_6: XLSX.WorkBook = XLSX.read(XLSX.write(newwb, {type: "string", bookType: "xlsx" }), {type: "string"}); + const CFB = XLSX.CFB; const vbawb = XLSX.readFile("test.xlsm", {bookVBA:true}); if(vbawb.vbaraw) {