mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 02:45:24 -05:00
fix(52514): overload Tags do not receive noImplicitAny errors on missing return types (#52518)
This commit is contained in:
@@ -14446,7 +14446,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
if (node.tags) {
|
||||
for (const tag of node.tags) {
|
||||
if (isJSDocOverloadTag(tag)) {
|
||||
result.push(getSignatureFromDeclaration(tag.typeExpression));
|
||||
const jsDocSignature = tag.typeExpression;
|
||||
if (jsDocSignature.type === undefined) {
|
||||
reportImplicitAny(jsDocSignature, anyType);
|
||||
}
|
||||
result.push(getSignatureFromDeclaration(jsDocSignature));
|
||||
hasJSDocOverloads = true;
|
||||
}
|
||||
}
|
||||
@@ -23419,6 +23423,11 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
case SyntaxKind.JSDocFunctionType:
|
||||
error(declaration, Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
|
||||
return;
|
||||
case SyntaxKind.JSDocSignature:
|
||||
if (noImplicitAny && isJSDocOverloadTag(declaration.parent)) {
|
||||
error(declaration.parent.tagName, Diagnostics.This_overload_implicitly_returns_the_type_0_because_it_lacks_a_return_type_annotation, typeAsString);
|
||||
}
|
||||
return;
|
||||
case SyntaxKind.FunctionDeclaration:
|
||||
case SyntaxKind.MethodDeclaration:
|
||||
case SyntaxKind.MethodSignature:
|
||||
|
||||
@@ -6213,6 +6213,10 @@
|
||||
"category": "Error",
|
||||
"code": 7011
|
||||
},
|
||||
"This overload implicitly returns the type '{0}' because it lacks a return type annotation.": {
|
||||
"category": "Error",
|
||||
"code": 7012
|
||||
},
|
||||
"Construct signature, which lacks return-type annotation, implicitly has an 'any' return type.": {
|
||||
"category": "Error",
|
||||
"code": 7013
|
||||
|
||||
Reference in New Issue
Block a user