mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Do not report error on implicityly any binding element if it is from parameter destructuring of private method
Fixes #8002
This commit is contained in:
@@ -2843,7 +2843,7 @@ namespace ts {
|
||||
if (isBindingPattern(element.name)) {
|
||||
return getTypeFromBindingPattern(<BindingPattern>element.name, includePatternInType);
|
||||
}
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
if (compilerOptions.noImplicitAny && canReportImplicitAnyError(element)) {
|
||||
reportImplicitAnyError(element, anyType);
|
||||
}
|
||||
return anyType;
|
||||
@@ -2936,14 +2936,18 @@ namespace ts {
|
||||
|
||||
// Report implicit any errors unless this is a private property within an ambient declaration
|
||||
if (reportErrors && compilerOptions.noImplicitAny) {
|
||||
const root = getRootDeclaration(declaration);
|
||||
if (!isPrivateWithinAmbient(root) && !(root.kind === SyntaxKind.Parameter && isPrivateWithinAmbient(root.parent))) {
|
||||
if (canReportImplicitAnyError(declaration)) {
|
||||
reportImplicitAnyError(declaration, type);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
function canReportImplicitAnyError(declaration: VariableLikeDeclaration) {
|
||||
const root = getRootDeclaration(declaration);
|
||||
return !isPrivateWithinAmbient(root) && !(root.kind === SyntaxKind.Parameter && isPrivateWithinAmbient(root.parent));
|
||||
}
|
||||
|
||||
function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
|
||||
Reference in New Issue
Block a user