diff --git a/src/compiler/transformers/declarations.ts b/src/compiler/transformers/declarations.ts index 43539cb06ad..ccb9dae665e 100644 --- a/src/compiler/transformers/declarations.ts +++ b/src/compiler/transformers/declarations.ts @@ -1372,6 +1372,8 @@ namespace ts { } const hasPrivateIdentifier = some(input.members, member => !!member.name && isPrivateIdentifier(member.name)); + // When the class has at least one private identifier, create a unique constant identifier to retain the nominal typing behavior + // Prevents other classes with the same public members from being used in place of the current class const privateIdentifier = hasPrivateIdentifier ? [ factory.createPropertyDeclaration( /*decorators*/ undefined,