The following code causes Flow server to crash (simplified example):
let err = new TypeError();
let constructor = typeof err.constructor === 'function' ? err.constructor : Error;
const clone = Object.create(constructor.prototype);
Whereas this doesn't:
let err = new TypeError();
let constructor = err.constructor;
if (typeof constructor !== 'function') {
constructor = Error;
}
const clone = Object.create(constructor.prototype);
Flow version: 0.110.1, 0.107.0
No errors!
Flow server crash.
Try Flow console output:
add_output: no source for error: EInvalidPrototype (: "empty prototype object"):
Crash examples:
Try Flow (ternary)
Try Flow (pipe)
Working example:
Try Flow (if statement)
Thanks for the excellent bug report! @panagosg7 has agreed to take a look.
Fixed by c66358199e8e578c51215271bfbbbe1514e27cfb