Fix invalid cast (#20426)

This commit is contained in:
Andy
2018-01-08 10:37:48 -08:00
committed by GitHub
parent c51dfa5596
commit 76eafe0e75
2 changed files with 4 additions and 4 deletions

View File

@@ -13462,7 +13462,7 @@ namespace ts {
}
}
function findFirstSuperCall(n: Node): Node {
function findFirstSuperCall(n: Node): SuperCall | undefined {
if (isSuperCall(n)) {
return n;
}
@@ -13478,12 +13478,12 @@ namespace ts {
*
* @param constructor constructor-function to look for super statement
*/
function getSuperCallInConstructor(constructor: ConstructorDeclaration): ExpressionStatement {
function getSuperCallInConstructor(constructor: ConstructorDeclaration): SuperCall | undefined {
const links = getNodeLinks(constructor);
// Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result
if (links.hasSuperCall === undefined) {
links.superCall = <ExpressionStatement>findFirstSuperCall(constructor.body);
links.superCall = findFirstSuperCall(constructor.body);
links.hasSuperCall = links.superCall ? true : false;
}
return links.superCall;

View File

@@ -3372,7 +3372,7 @@ namespace ts {
resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element
resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element
hasSuperCall?: boolean; // recorded result when we try to find super-call. We only try to find one if this flag is undefined, indicating that we haven't made an attempt.
superCall?: ExpressionStatement; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
superCall?: SuperCall; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
switchTypes?: Type[]; // Cached array of switch case expression types
}