From d338c20c152d86e0749a200c328517a50dd8d3a3 Mon Sep 17 00:00:00 2001 From: Guerric Phalippou Date: Tue, 24 Nov 2020 07:34:27 +0100 Subject: [PATCH] Add a comment to clarify the #private field (#41547) * add a comment to clarify the #private field * small fix --- src/compiler/transformers/declarations.ts | 2 ++ 1 file changed, 2 insertions(+) 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,