Redo in narrowing for intersections (#39637)

* Redo in-narrowing for intersections

Still need to carve out an exception for globalThis

* exempt globalThis from `in` narrowing
This commit is contained in:
Nathan Shively-Sanders
2020-07-30 14:58:22 -07:00
committed by GitHub
parent 32934a9989
commit d3877d294c
6 changed files with 72 additions and 6 deletions

View File

@@ -103,3 +103,10 @@ function positiveIntersectionTest(x: { a: string } & { b: string }) {
let n: never = x;
}
}
function negativeIntersectionTest() {
if ("ontouchstart" in window) {
window.ontouchstart
} else {
window.ontouchstart
}
}