From 96f4dd51c5f62b6dd21f9cd8ddcc5cb4f76ef7a8 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 11 Apr 2016 15:59:09 -0700 Subject: [PATCH] Helper rename as per PR feedback --- src/compiler/checker.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fc79da502c8..7b5fd18920e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2843,7 +2843,7 @@ namespace ts { if (isBindingPattern(element.name)) { return getTypeFromBindingPattern(element.name, includePatternInType); } - if (compilerOptions.noImplicitAny && canReportImplicitAnyError(element)) { + if (compilerOptions.noImplicitAny && !declarationBelongsToPrivateAmbientMember(element)) { reportImplicitAnyError(element, anyType); } return anyType; @@ -2936,16 +2936,17 @@ namespace ts { // Report implicit any errors unless this is a private property within an ambient declaration if (reportErrors && compilerOptions.noImplicitAny) { - if (canReportImplicitAnyError(declaration)) { + if (!declarationBelongsToPrivateAmbientMember(declaration)) { reportImplicitAnyError(declaration, type); } } return type; } - function canReportImplicitAnyError(declaration: VariableLikeDeclaration) { + function declarationBelongsToPrivateAmbientMember(declaration: VariableLikeDeclaration) { const root = getRootDeclaration(declaration); - return !isPrivateWithinAmbient(root) && !(root.kind === SyntaxKind.Parameter && isPrivateWithinAmbient(root.parent)); + const memberDeclaration = root.kind === SyntaxKind.Parameter ? root.parent : root; + return isPrivateWithinAmbient(memberDeclaration); } function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type {