@@ -129,23 +129,26 @@ namespace ts.codefix {
129129 const { symbol } = leftExpressionType ;
130130 if ( ! symbol || ! symbol . declarations ) return undefined ;
131131
132- const isClass = find ( symbol . declarations , isClassLike ) ;
132+ const classDeclaration = find ( symbol . declarations , isClassLike ) ;
133133 // Don't suggest adding private identifiers to anything other than a class.
134- if ( ! isClass && isPrivateIdentifier ( token ) ) {
134+ if ( ! classDeclaration && isPrivateIdentifier ( token ) ) {
135135 return undefined ;
136136 }
137137
138138 // Prefer to change the class instead of the interface if they are merged
139- const classOrInterface = isClass || find ( symbol . declarations , isInterfaceDeclaration ) ;
139+ const classOrInterface = classDeclaration || find ( symbol . declarations , isInterfaceDeclaration ) ;
140140 if ( classOrInterface && ! program . isSourceFileFromExternalLibrary ( classOrInterface . getSourceFile ( ) ) ) {
141141 const makeStatic = ( ( leftExpressionType as TypeReference ) . target || leftExpressionType ) !== checker . getDeclaredTypeOfSymbol ( symbol ) ;
142- // Static private identifier properties are not supported yet.
143- if ( makeStatic && isPrivateIdentifier ( token ) ) return undefined ;
142+ if ( makeStatic && ( isPrivateIdentifier ( token ) || isInterfaceDeclaration ( classOrInterface ) ) ) {
143+ return undefined ;
144+ }
145+
144146 const declSourceFile = classOrInterface . getSourceFile ( ) ;
145147 const inJs = isSourceFileJS ( declSourceFile ) ;
146148 const call = tryCast ( parent . parent , isCallExpression ) ;
147149 return { kind : InfoKind . ClassOrInterface , token, parentDeclaration : classOrInterface , makeStatic, declSourceFile, inJs, call } ;
148150 }
151+
149152 const enumDeclaration = find ( symbol . declarations , isEnumDeclaration ) ;
150153 if ( enumDeclaration && ! isPrivateIdentifier ( token ) && ! program . isSourceFileFromExternalLibrary ( enumDeclaration . getSourceFile ( ) ) ) {
151154 return { kind : InfoKind . Enum , token, parentDeclaration : enumDeclaration } ;
0 commit comments