@@ -42,7 +42,7 @@ function simple() {
4242  // Combined reducer also accepts any action. 
4343  const  combined  =  combineReducers ( {  sub : reducer  } ) 
4444
45-   let  cs  =  combined ( undefined ,  {  type : 'init'  } ) 
45+   let  cs :  {   sub :  State   }  =  combined ( undefined ,  {  type : 'init'  } ) 
4646  cs  =  combined ( cs ,  {  type : 'INCREMENT' ,  count : 10  } ) 
4747
4848  // Combined reducer's state is strictly checked. 
@@ -110,18 +110,17 @@ function discriminated() {
110110  // typings:expect-error 
111111  s  =  reducer ( s ,  {  type : 'SOME_OTHER_TYPE' ,  someField : 'value'  } ) 
112112
113-   // Combined reducer accepts a union actions types accepted each reducer, 
114-   // which can be very permissive for unknown third-party reducers. 
115-   const  combined  =  combineReducers ( { 
116-     sub : reducer , 
117-     unknown : ( state  =>  state )  as  Reducer 
118-   } ) 
113+   // Combined reducer accepts any action by default which allows to include 
114+   // third-party reducers without the need to add their actions to the union. 
115+   const  combined  =  combineReducers ( {  sub : reducer  } ) 
119116
120-   let  cs  =  combined ( undefined ,  {  type : 'init'  } ) 
121-   cs  =  combined ( cs ,  {  type : 'SOME_OTHER_TYPE' ,   someField :  'value'  } ) 
117+   let  cs :  {   sub :  State   }  =  combined ( undefined ,  {  type : 'init'  } ) 
118+   cs  =  combined ( cs ,  {  type : 'SOME_OTHER_TYPE'  } ) 
122119
123120  // Combined reducer can be made to only accept known actions. 
124-   const  strictCombined  =  combineReducers ( {  sub : reducer  } ) 
121+   const  strictCombined  =  combineReducers < {  sub : State  } ,  MyAction > ( { 
122+     sub : reducer 
123+   } ) 
125124
126125  strictCombined ( cs ,  {  type : 'INCREMENT'  } ) 
127126  // typings:expect-error 
@@ -180,7 +179,7 @@ function typeGuards() {
180179
181180  const  combined  =  combineReducers ( {  sub : reducer  } ) 
182181
183-   let  cs  =  combined ( undefined ,  {  type : 'init'  } ) 
182+   let  cs :  {   sub :  State   }  =  combined ( undefined ,  {  type : 'init'  } ) 
184183  cs  =  combined ( cs ,  {  type : 'INCREMENT' ,  count : 10  } ) 
185184} 
186185
0 commit comments