javascript - Flow type and merging json objects -


assume code of following kind (e.g. using lodash or explicitly here):

function extend(base, overwrite) {     (var key in overwrite)         base[key] = overwrite[key];     return base; }  var first = extend({     a: 1 }, {     b: 2 });  var second = extend({     c: 3 }, {     d: 4 });  console.log(first.a + first.b + second.c + second.d); 

how can explain flowtype fine?

try putting above function declaration:

declare function extend<a, b>(a: a, b: b): & b 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -