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

Omit optional properties by default? #65

Open
zhouzi opened this issue Dec 31, 2022 · 1 comment
Open

Omit optional properties by default? #65

zhouzi opened this issue Dec 31, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@zhouzi
Copy link
Owner

zhouzi commented Dec 31, 2022

From #63 (review):

What do you think about not adding the optional properties at all by default? By default the TypeScript plugins set the properties to title?: Maybe<string> and have an option "avoidOptionals" to remove the ?. So I feel like not adding the optional properties unless "avoidOptionals" is set to true would be closer to the TypeScript plugins' defaults and avoid issues similar to the one you faced.

@zhouzi zhouzi added the question Further information is requested label Dec 31, 2022
@jongbelegen
Copy link
Contributor

I think this idea makes sense.

Note that avoidOptionals can be used as a bool or AvoidOptionalsConfig.
For example, my config looks like this:

      avoidOptionals:
        field: true
        inputValue: false
        object: true
        defaultValue: true

@zhouzi zhouzi added enhancement New feature or request and removed question Further information is requested labels Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants