Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. // @flow
  2.  
  3. type Success = { value: boolean };
  4. type Failed = { error: string };
  5.  
  6. type Response = Success | Failed;
  7.  
  8. function handleResponse(response: Response) {
  9. if (response.value) {
  10. var value = response.value;
  11. } else {
  12. var error = response.error; // Error!
  13. }
  14. }
  15.  
  16. Cannot get `response.error` because property `error` is missing in `Success` [1].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement