Skip to content

fix: improve safety when resolving accessor types#71

Open
Divi2709 wants to merge 1 commit intowebpack:mainfrom
Divi2709:grammar/fix-accessor-safety
Open

fix: improve safety when resolving accessor types#71
Divi2709 wants to merge 1 commit intowebpack:mainfrom
Divi2709:grammar/fix-accessor-safety

Conversation

@Divi2709
Copy link
Copy Markdown

Fix unsafe access when resolving accessor types in processor.
Previously, accessor type resolution assumed that getSignature or setSignature would always be defined. This could lead to runtime errors when these properties were undefined.
This change adds optional chaining to safely access nested properties and preserves existing comments when signature comments are missing.
The output format remains unchanged, ensuring compatibility with doc-kit.

@linux-foundation-easycla
Copy link
Copy Markdown

linux-foundation-easycla bot commented Mar 30, 2026

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: Divi2709 / name: Divija (3215d0d)

Copy link
Copy Markdown
Member

@avivkeller avivkeller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has this error ever occurred? Given the context, these will always be defined, no?

@udaykumarreddykasaram07-eng
Copy link
Copy Markdown

I looked at the processor.mjs code I think avivkeller's question is valid. Since getSignature and setSignature come from TypeDoc's Declarationreflection, they would only exist on actual accessor declarations.It might be worth checking if there is a real case in webpack's types.d.ts where this would be undefined before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants