Skip to content

Commit 76eafe0

Browse files
author
Andy
authored
Fix invalid cast (microsoft#20426)
1 parent c51dfa5 commit 76eafe0

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/compiler/checker.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13462,7 +13462,7 @@ namespace ts {
1346213462
}
1346313463
}
1346413464

13465-
function findFirstSuperCall(n: Node): Node {
13465+
function findFirstSuperCall(n: Node): SuperCall | undefined {
1346613466
if (isSuperCall(n)) {
1346713467
return n;
1346813468
}
@@ -13478,12 +13478,12 @@ namespace ts {
1347813478
*
1347913479
* @param constructor constructor-function to look for super statement
1348013480
*/
13481-
function getSuperCallInConstructor(constructor: ConstructorDeclaration): ExpressionStatement {
13481+
function getSuperCallInConstructor(constructor: ConstructorDeclaration): SuperCall | undefined {
1348213482
const links = getNodeLinks(constructor);
1348313483

1348413484
// Only trying to find super-call if we haven't yet tried to find one. Once we try, we will record the result
1348513485
if (links.hasSuperCall === undefined) {
13486-
links.superCall = <ExpressionStatement>findFirstSuperCall(constructor.body);
13486+
links.superCall = findFirstSuperCall(constructor.body);
1348713487
links.hasSuperCall = links.superCall ? true : false;
1348813488
}
1348913489
return links.superCall;

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3372,7 +3372,7 @@ namespace ts {
33723372
resolvedJsxElementAttributesType?: Type; // resolved element attributes type of a JSX openinglike element
33733373
resolvedJsxElementAllAttributesType?: Type; // resolved all element attributes type of a JSX openinglike element
33743374
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.
3375-
superCall?: ExpressionStatement; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
3375+
superCall?: SuperCall; // Cached first super-call found in the constructor. Used in checking whether super is called before this-accessing
33763376
switchTypes?: Type[]; // Cached array of switch case expression types
33773377
}
33783378

0 commit comments

Comments
 (0)