Open
Description
No error from this code comparing two incompatible types:
function demo (someString: string, someArray: Array<number>): void {
// ERROR EXPECTED - none received
if (someArray === someString) {
// ...
}
}
someArray
can also be some other type, such as number
(arguable, if it was "==" instead of "===") or some object type (definitely useless, comparison to a pointer), it does not have to be an array.
My take:
If the types are known I would expect them to be enforced, only an unknown or yet-to-be-refined type should be comparable to (at that point potentially) incompatible types.
Activity