Skip to content

Commit

Permalink
feat(csv-parse): set columns type as readonly (#358)
Browse files Browse the repository at this point in the history
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`.
  • Loading branch information
blemoine authored Mar 15, 2024
1 parent 410e7b1 commit 44f2e7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/csv-stringify/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> | ColumnOption[]
columns?: readonly string[] | PlainObject<string> | readonly ColumnOption[]
/**
* Set the field delimiter, one character only, defaults to a comma.
*/
Expand Down

0 comments on commit 44f2e7c

Please sign in to comment.