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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -