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

Union type in actions #257

Merged
merged 8 commits into from
Jul 28, 2020

Conversation

special-character
Copy link
Contributor

This PR aims to solve #255.

  • Adds code generation in the <type>ModelSelector file for unions (unions don't generate an actual Model or Model.base file and I was following the pattern of putting the extra stuff in this file)
  • Adds imports to the <type>Union to the RootStore.base.ts file for use in actions
  • Adds generation to the queryHelper function to use the correct type if the action is using a field that is UNION

In order to test this out, I added an example search field in the twitter example (only server side right now). It uses a union type of User and Message to return results, which creates a new action in the RootStore.base.ts. I also tested out the generation in another project (my own) which also generates correct types.

@special-character special-character marked this pull request as draft July 22, 2020 00:54
@special-character special-character marked this pull request as ready for review July 22, 2020 17:07
Copy link
Collaborator

@chrisdrackett chrisdrackett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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