title: Property type is unknown with my state store in typescript
body: <p>I have no idea what I am doing. My type in my scan is coming up unknown, and I think there are a number of issues besides that.</p>
  <p>I know its something to do with the way scan works, and I replaced <code>getState</code> with <code>subscribe</code> (pretty sure that's wrong), because it was erroring and I couldn't fix it.</p>
  <pre class="lang-js prettyprint-override"><code>import Rx from 'rxjs';
  import { scan, share } from 'rxjs/operators';
  import { reducers } from './reducers/index';
  
  export default function createStore(initialState, reducers) {
    const subject = new Rx.Subject();
  
    const store = subject.pipe(scan(
      (state, action) =&gt; {
        if (!action || !action.type || ! (action.type in reducers)) {
          console.error('Action not registered'); 
          console.error(action); 
          console.error(action.type); 
          return state; 
        }
  
        return reducers[action.type].call(null, state, action);
      },
      initialState || {}
    )).pipe(share());
  
    const stateSymbol = Symbol('state');
    store.subscribe(state =&gt; {
      store[stateSymbol] = state;
    }, (err) =&gt; {
      console.error('Error in the store', err);
    });
    store.subscribe = () =&gt; store[stateSymbol];
  
    function dispatch(action) {
      return typeof action === 'function'
        ? action.call(null, subject, dispatch)
        : subject.next(action);
    }
  
    return {
      store,
      dispatch,
    };
  }
  </code></pre>