diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 40a3de7553f..ef2c589c393 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -96,7 +96,6 @@ namespace ts { getTypeAtLocation: getTypeOfNode, getPropertySymbolOfDestructuringAssignment, signatureToString, - indexSignatureToString, typeToString, getSymbolDisplayBuilder, symbolToString, @@ -2037,15 +2036,6 @@ namespace ts { return result; } - function indexSignatureToString(info: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node): string { - const writer = getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildIndexSignatureDisplay(info, writer, kind, enclosingDeclaration); - const result = writer.string(); - releaseStringWriter(writer); - - return result; - } - function typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string { const writer = getSingleLineStringWriter(); getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index d93aea8d26a..2a04916d45d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -2353,7 +2353,6 @@ namespace ts { getTypeAtLocation(node: Node): Type; getTypeFromTypeReference(node: TypeReferenceNode | ExpressionWithTypeArguments | JSDocTypeReference): Type; signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string; - indexSignatureToString(info: IndexInfo, kind: IndexKind, enclosingDeclaration?: Node): string; typeToString(type: Type, enclosingDeclaration?: Node, flags?: TypeFormatFlags): string; symbolToString(symbol: Symbol, enclosingDeclaration?: Node, meaning?: SymbolFlags): string; createSymbol(flags: SymbolFlags, name: string): Symbol; diff --git a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts index 7afbbbfd6a1..915b23f050b 100644 --- a/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts +++ b/src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts @@ -29,7 +29,7 @@ namespace ts.codefix { // Note that this is ultimately derived from a map indexed by symbol names, // so duplicates cannot occur. const implementedTypeSymbols = checker.getPropertiesOfType(implementedType); - const nonPrivateMembers = implementedTypeSymbols.filter(symbolRefersToNonPrivateMember); + const nonPrivateMembers = implementedTypeSymbols.filter(symbol => !(getModifierFlags(symbol.valueDeclaration) & ModifierFlags.Private)); let insertion = getMissingIndexSignatureInsertion(implementedType, IndexKind.Number, classDecl, hasNumericIndexSignature); insertion += getMissingIndexSignatureInsertion(implementedType, IndexKind.String, classDecl, hasStringIndexSignature); @@ -47,18 +47,17 @@ namespace ts.codefix { if (!hasIndexSigOfKind) { const IndexInfoOfKind = checker.getIndexInfoOfType(type, kind); if (IndexInfoOfKind) { - return checker.indexSignatureToString(IndexInfoOfKind, kind, enclosingDeclaration); + const writer = getSingleLineStringWriter(); + checker.getSymbolDisplayBuilder().buildIndexSignatureDisplay(IndexInfoOfKind, writer, kind, enclosingDeclaration); + const result = writer.string(); + releaseStringWriter(writer); + + return result; } } return ""; } - function symbolRefersToNonPrivateMember(symbol: Symbol): boolean { - const decls = symbol.getDeclarations(); - Debug.assert(!!(decls && decls.length > 0)); - return !(getModifierFlags(decls[0]) & ModifierFlags.Private); - } - function pushAction(result: CodeAction[], insertion: string, description: string): void { const newAction: CodeAction = { description: description,