@@ -183,8 +183,8 @@ namespace ts {
183183 return declaration ? getSignatureFromDeclaration(declaration) : undefined;
184184 },
185185 isImplementationOfOverload: node => {
186- node = getParseTreeNode(node, isFunctionLike);
187- return node ? isImplementationOfOverload(node ) : undefined;
186+ const parsed = getParseTreeNode(node, isFunctionLike);
187+ return parsed ? isImplementationOfOverload(parsed ) : undefined;
188188 },
189189 getImmediateAliasedSymbol: symbol => {
190190 Debug.assert((symbol.flags & SymbolFlags.Alias) !== 0, "Should only get Alias here.");
@@ -12569,7 +12569,7 @@ namespace ts {
1256912569 }
1257012570 }
1257112571
12572- function getContainingObjectLiteral(func: FunctionLikeDeclaration ) {
12572+ function getContainingObjectLiteral(func: FunctionLike ) {
1257312573 return (func.kind === SyntaxKind.MethodDeclaration ||
1257412574 func.kind === SyntaxKind.GetAccessor ||
1257512575 func.kind === SyntaxKind.SetAccessor) && func.parent.kind === SyntaxKind.ObjectLiteralExpression ? <ObjectLiteralExpression>func.parent :
@@ -12587,7 +12587,7 @@ namespace ts {
1258712587 });
1258812588 }
1258912589
12590- function getContextualThisParameterType(func: FunctionLikeDeclaration ): Type {
12590+ function getContextualThisParameterType(func: FunctionLike ): Type {
1259112591 if (func.kind === SyntaxKind.ArrowFunction) {
1259212592 return undefined;
1259312593 }
@@ -12764,7 +12764,7 @@ namespace ts {
1276412764 return false;
1276512765 }
1276612766
12767- function getContextualReturnType(functionDecl: FunctionLikeDeclaration ): Type {
12767+ function getContextualReturnType(functionDecl: FunctionLike ): Type {
1276812768 // If the containing function has a return type annotation, is a constructor, or is a get accessor whose
1276912769 // corresponding set accessor has a type annotation, return statements in the function are contextually typed
1277012770 if (functionDecl.kind === SyntaxKind.Constructor ||
@@ -17862,7 +17862,7 @@ namespace ts {
1786217862 error(node, Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
1786317863 }
1786417864 }
17865- if (node.questionToken && isBindingPattern(node.name) && func.body) {
17865+ if (node.questionToken && isBindingPattern(node.name) && ( func as FunctionLikeDeclaration) .body) {
1786617866 error(node, Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature);
1786717867 }
1786817868 if ((<Identifier>node.name).text === "this") {
@@ -18622,12 +18622,12 @@ namespace ts {
1862218622 let hasOverloads = false;
1862318623 let bodyDeclaration: FunctionLikeDeclaration;
1862418624 let lastSeenNonAmbientDeclaration: FunctionLikeDeclaration;
18625- let previousDeclaration: FunctionLikeDeclaration ;
18625+ let previousDeclaration: FunctionLike ;
1862618626
1862718627 const declarations = symbol.declarations;
1862818628 const isConstructor = (symbol.flags & SymbolFlags.Constructor) !== 0;
1862918629
18630- function reportImplementationExpectedError(node: FunctionLikeDeclaration ): void {
18630+ function reportImplementationExpectedError(node: FunctionLike ): void {
1863118631 if (node.name && nodeIsMissing(node.name)) {
1863218632 return;
1863318633 }
@@ -18686,7 +18686,7 @@ namespace ts {
1868618686 let duplicateFunctionDeclaration = false;
1868718687 let multipleConstructorImplementation = false;
1868818688 for (const current of declarations) {
18689- const node = <FunctionLikeDeclaration >current;
18689+ const node = <FunctionLike >current;
1869018690 const inAmbientContext = isInAmbientContext(node);
1869118691 const inAmbientContextOrInterface = node.parent.kind === SyntaxKind.InterfaceDeclaration || node.parent.kind === SyntaxKind.TypeLiteral || inAmbientContext;
1869218692 if (inAmbientContextOrInterface) {
@@ -18707,7 +18707,7 @@ namespace ts {
1870718707 someHaveQuestionToken = someHaveQuestionToken || hasQuestionToken(node);
1870818708 allHaveQuestionToken = allHaveQuestionToken && hasQuestionToken(node);
1870918709
18710- if (nodeIsPresent(node.body) && bodyDeclaration) {
18710+ if (nodeIsPresent(( node as FunctionLikeDeclaration) .body) && bodyDeclaration) {
1871118711 if (isConstructor) {
1871218712 multipleConstructorImplementation = true;
1871318713 }
@@ -18719,9 +18719,9 @@ namespace ts {
1871918719 reportImplementationExpectedError(previousDeclaration);
1872018720 }
1872118721
18722- if (nodeIsPresent(node.body)) {
18722+ if (nodeIsPresent(( node as FunctionLikeDeclaration) .body)) {
1872318723 if (!bodyDeclaration) {
18724- bodyDeclaration = node;
18724+ bodyDeclaration = node as FunctionLikeDeclaration ;
1872518725 }
1872618726 }
1872718727 else {
@@ -18731,7 +18731,7 @@ namespace ts {
1873118731 previousDeclaration = node;
1873218732
1873318733 if (!inAmbientContextOrInterface) {
18734- lastSeenNonAmbientDeclaration = node;
18734+ lastSeenNonAmbientDeclaration = node as FunctionLikeDeclaration ;
1873518735 }
1873618736 }
1873718737 }
@@ -19928,7 +19928,7 @@ namespace ts {
1992819928 forEach((<BindingPattern>node.name).elements, checkSourceElement);
1992919929 }
1993019930 // For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
19931- if (node.initializer && getRootDeclaration(node).kind === SyntaxKind.Parameter && nodeIsMissing(getContainingFunction(node).body)) {
19931+ if (node.initializer && getRootDeclaration(node).kind === SyntaxKind.Parameter && nodeIsMissing(( getContainingFunction(node) as FunctionLikeDeclaration ).body)) {
1993219932 error(node, Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
1993319933 return;
1993419934 }
@@ -20527,12 +20527,12 @@ namespace ts {
2052720527 // TODO: Check that target label is valid
2052820528 }
2052920529
20530- function isGetAccessorWithAnnotatedSetAccessor(node: FunctionLikeDeclaration ) {
20530+ function isGetAccessorWithAnnotatedSetAccessor(node: FunctionLike ) {
2053120531 return node.kind === SyntaxKind.GetAccessor
2053220532 && getEffectiveSetAccessorTypeAnnotationNode(getDeclarationOfKind<SetAccessorDeclaration>(node.symbol, SyntaxKind.SetAccessor)) !== undefined;
2053320533 }
2053420534
20535- function isUnwrappedReturnTypeVoidOrAny(func: FunctionLikeDeclaration , returnType: Type): boolean {
20535+ function isUnwrappedReturnTypeVoidOrAny(func: FunctionLike , returnType: Type): boolean {
2053620536 const unwrappedReturnType = (getFunctionFlags(func) & FunctionFlags.AsyncGenerator) === FunctionFlags.Async
2053720537 ? getPromisedTypeOfPromise(returnType) // Async function
2053820538 : returnType; // AsyncGenerator function, Generator function, or normal function
@@ -23053,8 +23053,8 @@ namespace ts {
2305323053 return false;
2305423054 }
2305523055
23056- function isImplementationOfOverload(node: FunctionLikeDeclaration ) {
23057- if (nodeIsPresent(node.body)) {
23056+ function isImplementationOfOverload(node: FunctionLike ) {
23057+ if (nodeIsPresent(( node as FunctionLikeDeclaration) .body)) {
2305823058 const symbol = getSymbolOfNode(node);
2305923059 const signaturesOfSymbol = getSignaturesOfSymbol(symbol);
2306023060 // If this function body corresponds to function with multiple signature, it is implementation of overload
0 commit comments