Fixes type predicate crash bug
This commit is contained in:
parent
6db4faf488
commit
752e0ba003
|
@ -5761,6 +5761,7 @@ namespace ts {
|
|||
let signature = getResolvedSignature(expr);
|
||||
|
||||
if (signature.typePredicate &&
|
||||
expr.arguments[signature.typePredicate.parameterIndex] &&
|
||||
getSymbolAtLocation(expr.arguments[signature.typePredicate.parameterIndex]) === symbol) {
|
||||
|
||||
if (!assumeTrue) {
|
||||
|
|
|
@ -23,6 +23,10 @@ function hasMissingIsKeyword(): x {
|
|||
return true;
|
||||
}
|
||||
|
||||
function hasMissingParameter(): x is A {
|
||||
return true;
|
||||
}
|
||||
|
||||
function hasMissingTypeInTypeGuardType(x): x is {
|
||||
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 {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Should not crash the compiler
|
||||
var x: A;
|
||||
if (hasMissingParameter()) {
|
||||
x.propA;
|
||||
}
|
Loading…
Reference in a new issue