Fixes type predicate crash bug
This commit is contained in:
parent
6db4faf488
commit
752e0ba003
2 changed files with 11 additions and 0 deletions
|
@ -5761,6 +5761,7 @@ namespace ts {
|
||||||
let signature = getResolvedSignature(expr);
|
let signature = getResolvedSignature(expr);
|
||||||
|
|
||||||
if (signature.typePredicate &&
|
if (signature.typePredicate &&
|
||||||
|
expr.arguments[signature.typePredicate.parameterIndex] &&
|
||||||
getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) {
|
getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) {
|
||||||
|
|
||||||
if (!assumeTrue) {
|
if (!assumeTrue) {
|
||||||
|
|
|
@ -23,6 +23,10 @@ function hasMissingIsKeyword(): x {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasMissingParameter(): x is A {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function hasMissingTypeInTypeGuardType(x): x is {
|
function hasMissingTypeInTypeGuardType(x): x is {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -132,4 +136,10 @@ function b6([a, b, p1], p2, p3): p1 is A {
|
||||||
|
|
||||||
function b7({a, b, c: {p1}}, p2, p3): p1 is A {
|
function b7({a, b, c: {p1}}, p2, p3): p1 is A {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Should not crash the compiler
|
||||||
|
var x: A;
|
||||||
|
if (hasMissingParameter()) {
|
||||||
|
x.propA;
|
||||||
}
|
}
|
Loading…
Reference in a new issue