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

Support union type of object literal #9

Open
kohii opened this issue Apr 1, 2023 · 0 comments
Open

Support union type of object literal #9

kohii opened this issue Apr 1, 2023 · 0 comments
Labels
area: Form Field enhancement New feature or request

Comments

@kohii
Copy link
Contributor

kohii commented Apr 1, 2023

Summary

Add support for union types of object.

e.g.

type NetworkLoadingState = {
  state: "loading";
};
type NetworkFailedState = {
  state: "failed";
  code: number;
};
type NetworkSuccessState = {
  state: "success";
  response: {
    title: string;
    duration: number;
    summary: string;
  };
};
// Create a type which represents only one of the above types
// but you aren't sure which it is yet.
type NetworkState =
  | NetworkLoadingState
  | NetworkFailedState
  | NetworkSuccessState;

Handbook - Unions and Intersection Types

@kohii kohii converted this from a draft issue Apr 1, 2023
@kohii kohii added enhancement New feature or request area: Form Field labels Apr 1, 2023
@kohii kohii moved this from Idea to Planned in Moyuk Roadmap Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Form Field enhancement New feature or request
Projects
Status: Planned
Development

No branches or pull requests

1 participant