title: Switch for specific type in TypeScript
body: <p>I have an interface <code>Action</code>:</p>
  
  <pre><code>interface Action {}
  </code></pre>
  
  <p>And an implementation of this <code>Action</code> <code>SpecificAction</code>:</p>
  
  <pre><code>class SpecificAction implements Action {
     payload?: Any
  }
  </code></pre>
  
  <p>Is it possible in TS to construct a switch operator, like this:</p>
  
  <pre><code>let action: Action
  switch (action) {
     case SpecificAction: //it works
         console.log(action.payload) // it doesn't 
  }
  </code></pre>
  
  <p>Is it possible in that case to know, that action is already of <code>SpecificAction</code> type?</p>