diff --git a/types/json2csv/JSON2CSVBase.d.ts b/types/json2csv/JSON2CSVBase.d.ts index c5f328db1f..1faf2a5318 100644 --- a/types/json2csv/JSON2CSVBase.d.ts +++ b/types/json2csv/JSON2CSVBase.d.ts @@ -92,9 +92,10 @@ declare abstract class JSON2CSVBase { * Performs the flattening of a data row recursively * * @param {object} dataRow Original JSON object + * @param {string} separator Separator to be used as the flattened field name * @returns {object} Flattened object */ - protected flatten(dataRow: T): object; + protected flatten(dataRow: T, separator: string): object; /** * Performs the unwind recursively in specified sequence diff --git a/types/json2csv/JSON2CSVTransform.d.ts b/types/json2csv/JSON2CSVTransform.d.ts index 1785e09214..f453ece8b1 100644 --- a/types/json2csv/JSON2CSVTransform.d.ts +++ b/types/json2csv/JSON2CSVTransform.d.ts @@ -80,9 +80,10 @@ declare class JSON2CSVTransform extends Transform { // implements JSON2CSVBas * Performs the flattening of a data row recursively * * @param {object} dataRow Original JSON object + * @param {string} separator Separator to be used as the flattened field name * @returns {object} Flattened object */ - protected flatten(dataRow: T): object; + protected flatten(dataRow: T, separator: string): object; /** * Performs the unwind recursively in specified sequence diff --git a/types/json2csv/index.d.ts b/types/json2csv/index.d.ts index 55a1829625..55aca2687c 100644 --- a/types/json2csv/index.d.ts +++ b/types/json2csv/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for json2csv 4.1 +// Type definitions for json2csv 4.2 // Project: https://github.com/zemirco/json2csv // Definitions by: Juanjo Diaz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/json2csv/json2csv-tests.ts b/types/json2csv/json2csv-tests.ts index 67c46cd1c3..42f8a58b70 100644 --- a/types/json2csv/json2csv-tests.ts +++ b/types/json2csv/json2csv-tests.ts @@ -76,7 +76,7 @@ class ParserExt extends Parser { s = this.processValue(new Date(), true); s = this.processValue({}, true); s = this.processValue([], true); - const flattenedData: object = this.flatten({}); + const flattenedData: object = this.flatten({}, '.'); const unwindedData: object[] = this.unwindData([], []); } } @@ -110,7 +110,7 @@ class TransformExt extends Transform { s = this.processValue(new Date(), true); s = this.processValue({}, true); s = this.processValue([], true); - const flattenedData: object = this.flatten({}); + const flattenedData: object = this.flatten({}, '.'); const unwindedData: object[] = this.unwindData([], []); } }