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
Post a Comment