Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ts): set columns type as readonly #358

Merged
merged 1 commit into from Mar 15, 2024
Merged

Conversation

blemoine
Copy link
Contributor

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.

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`.
@wdavidw
Copy link
Member

wdavidw commented Aug 16, 2022

This is pretty much the case for every option. Not sure it provide much value.

@blemoine
Copy link
Contributor Author

blemoine commented Aug 16, 2022

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.

@ViniciusLovato
Copy link

Recently, I encountered the same problem. It would be helpful to support values declared as const.

@wdavidw
Copy link
Member

wdavidw commented Aug 25, 2023

Then I propose to update this PR to apply const to every option.

@yoursunny
Copy link

The Input type should be readonly too.

@wdavidw wdavidw merged commit 44f2e7c into adaltas:master Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants