Skip to content

Commit d338c20

Browse files
authored
Add a comment to clarify the #private field (#41547)
* add a comment to clarify the #private field * small fix
1 parent d163ab6 commit d338c20

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/compiler/transformers/declarations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1372,6 +1372,8 @@ namespace ts {
13721372
}
13731373

13741374
const hasPrivateIdentifier = some(input.members, member => !!member.name && isPrivateIdentifier(member.name));
1375+
// When the class has at least one private identifier, create a unique constant identifier to retain the nominal typing behavior
1376+
// Prevents other classes with the same public members from being used in place of the current class
13751377
const privateIdentifier = hasPrivateIdentifier ? [
13761378
factory.createPropertyDeclaration(
13771379
/*decorators*/ undefined,

0 commit comments

Comments
 (0)