You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeMyState={foo: number;};typeReducer<T>=(state: T)=>T;constreducer1: Reducer<MyState>=(state)=>{return{foo: 123,bar: 123};// works.};constreducer2=(state: MyState) : MyState=>{return{foo: 123,bar: 123};// fails.// Type '{ foo: number; bar: number; }' is not // assignable to type 'MyState'.// Object literal may only specify known properties, // and 'bar' does not exist in type 'MyState'.};
Expected behavior:
The implementations for reducer1 and reducer2 have the same behavior.
Actual behavior:
The implementations for reducer1 and reducer2 have different behavior.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.4.0
Code
Expected behavior:
The implementations for
reducer1
andreducer2
have the same behavior.Actual behavior:
The implementations for
reducer1
andreducer2
have different behavior.The text was updated successfully, but these errors were encountered: