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

Generate defaults with Partial<T> #31

Closed
sdboyer opened this issue Sep 11, 2021 · 0 comments · Fixed by #48
Closed

Generate defaults with Partial<T> #31

sdboyer opened this issue Sep 11, 2021 · 0 comments · Fixed by #48
Labels
kind/bug Something isn't working

Comments

@sdboyer
Copy link
Contributor

sdboyer commented Sep 11, 2021

Currently, the defaults we generate may not pass Typescript's type checker. An incomplete cue.Value (one that has at least one required field without a default and therefore cannot be rendered to a concrete form like JSON) will fail, because the default const produced will lack any entry for that required field.

I think the simplest fix here is just to always generate our default consts with Partial<T>. We could do so conditionally based on a concreteness check, but until we're aware of a use case (@ryantxu?) that really requires a default not being Partial, this seems the best solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant