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
I've noticed this issue while upgrading from v3.0.3. Type inferrence got broken on some of redux's connect calls. I was able to isolate the issue (see the code below). The issue is reproducible on @next and @latest. I ran some regression tests and was able to narrow it down to 3.1.0-dev.20180810 where the bug was introduced. The last version where the code works as expected was 3.1.0-dev.20180809.
Code
typeMapStateToProps<TStateProps>=()=>TStateProps;typeMergeProps<TStateProps,TMergedProps>=(stateProps: TStateProps)=>TMergedProps;functionconnect<TStateProps={},TMergedProps={}>(mapStateToProps: MapStateToProps<TStateProps>,mergeProps: MergeProps<TStateProps,TMergedProps>){}connect(()=>({time: 123}),({ time })=>({
time,doSomething(){},}))
Expected behavior: compiles without errors
Actual behavior:error TS2459: Type 'TStateProps' has no property 'time' and no string index signature.
Somehow these examples compile without problem though:
// no 'expression body' in C# termsconnect(()=>({time: 123}),({ time })=>{return{
time,doSomething(){},}})// no 'time' on TMergedPropsconnect(()=>({time: 123}),({ time })=>({doSomething(){},}))// property instead of a functionconnect(()=>({time: 123}),({ time })=>({
time,doSomething: ()=>{},}))
The text was updated successfully, but these errors were encountered:
TypeScript Version: 3.1.0-dev.20180810
Search Terms: react-redux connect type inference
I've noticed this issue while upgrading from v3.0.3. Type inferrence got broken on some of redux's
connect
calls. I was able to isolate the issue (see the code below). The issue is reproducible on@next
and@latest
. I ran some regression tests and was able to narrow it down to3.1.0-dev.20180810
where the bug was introduced. The last version where the code works as expected was3.1.0-dev.20180809
.Code
Expected behavior: compiles without errors
Actual behavior:
error TS2459: Type 'TStateProps' has no property 'time' and no string index signature.
Playground Link: here
Somehow these examples compile without problem though:
The text was updated successfully, but these errors were encountered: