Closed
Description
To completely fix #1587 TypeScript should also support:
function repro(message: Object | Object[]) {
if (message instanceof Array) {
message = message.filter; // error
}
}
Currently it results in Property 'entries' does not exist on type 'Object | Object[]'
. It seems message
on the RHS switches from Array
back to Object | Object[]
prematurely.
Workaround:
function workaround(message: Object | Object[]) {
var theMessage = message;
if (theMessage instanceof Array) {
message = theMessage.filter;
}
}