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

Scaffold nullable types as "(type | null)" #378

Closed
wants to merge 1 commit into from

Conversation

smokku
Copy link
Contributor

@smokku smokku commented Jun 28, 2022

Nullable types are generated as optional in typescript files. This makes the fields of type | undefined.

When you try to set null as such field, TS compiler refuses to assign null to optional field.

The main problem is that it prevents sending null to backend to erase field value in mutation.

Workaround is to do something like this

store.mutateSetSomething({
  value: null as unknown as undefined,
})

This PR fixes this by generating nullable types as (type | null).

@jesse-savary
Copy link
Member

Hey @smokku, I've added your commits into #382 because the development branch is more up to date than main. Please give version 0.17.0 a go and let me know what you think.

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

2 participants