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
Looping over an array generated from an object literal, breaks the return type when using Object.entries, but works just fine when using Object.keys and then returning obj[key].
/* @flow */typeValue={num: number,str: string,}constgetValues=(): {[string]: Value}=>({key1: {num: 999,str: 'hello',},key2: {num: 42,str: 'what is my purpose?',},});// This worksconstvalues: Value[]=Object.keys(getValues()).map(key=>getValues()[key]);// This doesn'tconstvalues2: Value[]=Object.entries(getValues()).map(([key,value])=>value)
There might be some nuances I don't get on why this brakes, but it seems to me that they should behave in the same way (they definitely return the same data).
Thanks a bunch!
The text was updated successfully, but these errors were encountered:
Looping over an array generated from an object literal, breaks the return type when using
Object.entries
, but works just fine when usingObject.keys
and then returningobj[key]
.Offending code (also reproduced on Try Flow)
There might be some nuances I don't get on why this brakes, but it seems to me that they should behave in the same way (they definitely return the same data).
Thanks a bunch!
The text was updated successfully, but these errors were encountered: