title: Typescript, @ngrx and default store values
body: <p>I think I am missing something obvious trying to work with <a href="https://github.com/ngrx/store" rel="nofollow">@ngrx</a>. I am trying to use nested reducers, and want to be able to return default starting child values. This is my child</p>
  
  <pre><code>export const counter:Reducer&lt;number&gt; = 
      (state:number = 0, action:Action = {type:null}) =&gt; {
  
      switch (action.type) {
  </code></pre>
  
  <p>My question is how to use this to initialise an extra counter. My counters.ts looks like</p>
  
  <pre><code>export const counters:Reducer&lt;number[]&gt; = (state:number[] = [], action:Action) =&gt; {
  
      switch (action.type) {
          case ADD_COUNTER:
              return [counter(), ...state];
  </code></pre>
  
  <p>This works but I have a typescript error on counter: <code>Supplied parameters do not match any signature of call target</code> and I'm wondering how to get around this.</p>
  
  <p>I'm using @ngrx, which provides this:</p>
  
  <pre><code>export interface Action {
    type: string;
    payload?: any;
  }
  
  export interface Reducer&lt;T&gt; {
    (state: T, action: Action): T;
  }
  
  export class Store&lt;T&gt; extends BehaviorSubject&lt;T&gt; {
      private _storeSubscription: Subscription&lt;T&gt;
      constructor(private _dispatcher:Dispatcher&lt;Action&gt;, private _reducers:{[key:string]:Reducer&lt;any&gt;}, initialState: T) {
      super(initialState);
      let rootReducer = this._mergeReducers(_reducers, initialState);
      this._storeSubscription = rootReducer.subscribe(this);
      }
  </code></pre>