node-csv
node-csv copied to clipboard
feat(ts): set `columns` type as `readonly`
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
.
This is pretty much the case for every option. Not sure it provide much value.
If you try the following code
const columns = ['name', 'age'] as const
stringify({columns})
without this PR patch, it won't compile - even though it's perfectly valid at runtime.
Recently, I encountered the same problem. It would be helpful to support values declared as const
.
Then I propose to update this PR to apply const
to every option.
The Input
type should be readonly too.