diff --git a/types/json2csv/JSON2CSVBase.d.ts b/types/json2csv/JSON2CSVBase.d.ts index 022c7cab77..51c87e1a6c 100644 --- a/types/json2csv/JSON2CSVBase.d.ts +++ b/types/json2csv/JSON2CSVBase.d.ts @@ -27,6 +27,7 @@ export declare namespace json2csv { unwind?: string | Array; unwindBlank?: boolean; flatten?: boolean; + flattenSeparator?: string; defaultValue?: string; quote?: string; doubleQuote?: string; diff --git a/types/json2csv/index.d.ts b/types/json2csv/index.d.ts index edf693cc3d..a8e734576b 100644 --- a/types/json2csv/index.d.ts +++ b/types/json2csv/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/zemirco/json2csv // Definitions by: Juanjo Diaz // Daniel Gooß +// Denis Yilmaz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/json2csv/json2csv-tests.ts b/types/json2csv/json2csv-tests.ts index cad3745d68..179a0df127 100644 --- a/types/json2csv/json2csv-tests.ts +++ b/types/json2csv/json2csv-tests.ts @@ -86,6 +86,15 @@ try { console.error(err); } +// Test for Synchronous Parser with flatten and custom flattenSeparator +try { + const parser = new Parser({ ...opts, flatten: true, flattenSeparator: ' / ' }); + const csv = parser.parse({ car: '', price: 1, foo: { bar: '' } }); + console.log(csv); +} catch (err) { + console.error(err); +} + // Test convenience method "parse" try { const csv = parse(data, opts);