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

Boolean field sets the attribute to be optional #73

Open
davidsandoz opened this issue Aug 28, 2024 · 2 comments · May be fixed by #75
Open

Boolean field sets the attribute to be optional #73

davidsandoz opened this issue Aug 28, 2024 · 2 comments · May be fixed by #75

Comments

@davidsandoz
Copy link

With a boolean field, the generated type is

  fieldName?: boolean;

Which means the field can either be true, false or undefined.

In Storyblok, when we set such a field, there's no option to set whether it is required or not, like with other field types. Moreover, there's a default value that can be either true or false.

With this in mind, shouldn't the generated type strictly be a boolean? e.g.:

  fieldName: boolean;
@dohomi
Copy link
Owner

dohomi commented Aug 29, 2024

if you are sure about it you can raise a PR, but I honestly would not mind to keep it as is

xaverfleer pushed a commit to xaverfleer/storyblok-generate-ts that referenced this issue Sep 18, 2024
xaverfleer pushed a commit to xaverfleer/storyblok-generate-ts that referenced this issue Sep 18, 2024
xaverfleer pushed a commit to xaverfleer/storyblok-generate-ts that referenced this issue Sep 18, 2024
xaverfleer pushed a commit to xaverfleer/storyblok-generate-ts that referenced this issue Sep 18, 2024
@xaverfleer
Copy link

Awesome, thank you. I created PR #75 for this.

Let me know, how I can still improve it, if you prefer it to be adapted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants