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
docs: consistently quote props for editing #726
Conversation
This patches node-fetch so pnpm install works on Node 20: pnpm/pnpm#6424
When using ArkType, users will frequently add characters like `?` that need to be quoted, so we should quote props consistently when they are used.
Thanks for the suggestion! I agree there is some benefit to being able to make a prop optional by adding a single character, but I'm still not necessarily sure that's what we'd want by default everywhere in the codebase yet. It also seems like adding consistent key quotes wouldn't help in a situation where someone defines a definition with no optional keys and then wants to make something optional, which would be a pretty common case. I'm also considering allowing alternate optional key syntax in our upcoming release to help mitigate this problem (would be either I will ponder this, any feedback would be welcome! |
I understand these assumptions aren't perfect, but I think they'd generally be helpful, especially for end users. I originally planned to just make this change in the docs. Would you be more comfortable with that?
Good points here. Maybe it would be better to just have users explicitly add |
@nickmccurdy Right now the behavior mirrors TS, because adding "?" to a key just makes the key optional. During validation, it assumes Conversely, if you add I'm sure it could be parsed but I think the DX would be much worse, and yes, probably a lot less efficient for TS. I've thought a lot about the optional key syntax and keep coming back to just including it in the key as the best option, even though it's obnoxious. My fallbacks if I constantly get the feedback that it's frustrating would be one of the two alternatives I mentioned. I don't think I want to quote all key strings by default, but this could perhaps be a setting we mention as an option for users frustrated with the setup as is. |
Depends on #725
When using ArkType, users will frequently add characters like
?
that need to be quoted, so we should quote props consistently when they are used.