From 44f2e7c2d1c36adf2b1f5a32ee181b3c4c4b50d7 Mon Sep 17 00:00:00 2001 From: Benoit Lemoine Date: Fri, 15 Mar 2024 06:36:29 -0400 Subject: [PATCH] feat(csv-parse): set `columns` type as `readonly` (#358) The goal is for stringify to support values declared `as const`. eg. ``` const columns = ['name', 'age'] as const stringify({columns}) ``` As this array has no reasons to be mutated by `stringify` it's simpler to set it as `readonly`. --- packages/csv-stringify/lib/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/csv-stringify/lib/index.d.ts b/packages/csv-stringify/lib/index.d.ts index 4c28ef9e..618b7ee6 100644 --- a/packages/csv-stringify/lib/index.d.ts +++ b/packages/csv-stringify/lib/index.d.ts @@ -61,7 +61,7 @@ export interface Options extends stream.TransformOptions { * can refer to nested properties of the input JSON * see the "header" option on how to print columns names on the first line */ - columns?: string[] | PlainObject | ColumnOption[] + columns?: readonly string[] | PlainObject | readonly ColumnOption[] /** * Set the field delimiter, one character only, defaults to a comma. */