title: Property does not exist on type within Redux reducer using TypeScript?
body: <p>I'm trying to use Redux with TypeScript in a little learning project, following this tutorial:
  <a href="https://redux.js.org/recipes/usage-with-typescript/" rel="nofollow noreferrer">https://redux.js.org/recipes/usage-with-typescript/</a></p>
  
  <pre><code>const INITIAL_STATE: TweetsState = {
    tweets: []
  };
  
  const tweetsReducer: Reducer&lt;TweetsState&gt; = (
    state = INITIAL_STATE,
    action: TweetAction
  ): TweetsState =&gt; {
    switch (action.type) {
      case GET_TWEETS:
        return {
          ...state
        };
  
      case TWEETS_RECEIVED:
        return {
          tweets: [...state.tweets, action.payload]
        };
  
      default:
        return state;
    }
  };
  </code></pre>
  
  <p>My reducer expects an action of type TweetAction, which is the union of two interfaces:</p>
  
  <pre><code>export interface IGetTweetsAction {
    type: typeof GET_TWEETS;
  }
  
  export interface ITweetsReceivedAction {
    type: typeof TWEETS_RECEIVED;
    payload: ITweet[];
  }
  
  export const GET_TWEETS: string = "GET_TWEETS";
  export const TWEETS_RECEIVED: string = "TWEETS_RECEIVED";
  
  export type TweetAction = IGetTweetsAction | ITweetsReceivedAction;
  </code></pre>
  
  <p>However, within my reducer, I get the error <code>Property 'payload' does not exist on type 'TweetAction'</code> which is confusing because it suggests the union hasn't worked?</p>
  
  <p>But this is further confusing because within my actions file it clearly allows me to return an object, of type TweetAction, with a payload:</p>
  
  <pre><code>import {
    TweetAction,
    GET_TWEETS,
    TWEETS_RECEIVED,
    ITweet
  } from "./tweets.types";
  
  export const getTweets = (): TweetAction =&gt; ({
    type: GET_TWEETS
  });
  
  export const tweetsReceived = (tweets: ITweet[]): TweetAction =&gt; ({
    type: TWEETS_RECEIVED,
    payload: tweets
  });
  </code></pre>
  
  <p>I'm aware the code is currently a bit of a mess (I sometimes instinctively prefix interfaces with I being a C# dev, sorry!) as I haven't been through a refactory stage yet as I'm just trying to whip something up quickly, but I've been stumped by this error.</p>
  
  <p>Can anyone see what's going wrong? It's probably something straight forward but the isolation might be getting to my head.</p>
  
  <p>Thanks!</p>
  
  <p>Edit: Note that removing the typesafety and changing:
  <code>action: TweetAction</code> to just <code>action</code> allows me to do <code>action.payload</code> and the functionality works fine...</p>