Skip to content

fix: improve JSDoc parameter validation for optional and destructured params#32

Merged
Zih0 merged 6 commits intomainfrom
fix/check-collect-util
Mar 29, 2026
Merged

fix: improve JSDoc parameter validation for optional and destructured params#32
Zih0 merged 6 commits intomainfrom
fix/check-collect-util

Conversation

@Zih0
Copy link
Copy Markdown
Collaborator

@Zih0 Zih0 commented Mar 29, 2026

  • Fix false "unused @param" errors for optional parameters (options?: T) by using getNonNullableType() to unwrap
    the union type before resolving interface properties
  • Fix cross-mismatch between JSDoc virtual root names and destructured parameters by matching them positionally

Details

Optional parameter fix

When a parameter is optional (options?: Options), param.getType() returns T | undefined.
getSymbol() on a union type returns undefined, causing all sub-properties to be unresolved. Adding
getNonNullableType() strips the undefined before symbol lookup.

Destructured parameter fix

JSDoc documents destructured params with a virtual root name:

// Code: ({ baseUrl }: Options)
// JSDoc: @param options / @param options.baseUrl

collectParameterPaths now returns structured ParameterPathEntry objects with a destructured flag.
FunctionValidator.resolveDestructuredNames assigns JSDoc root names to destructured params by position.

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docflow-docs Ready Ready Preview, Comment Mar 29, 2026 11:47am

Request Review

@Zih0 Zih0 merged commit 3e5d873 into main Mar 29, 2026
3 checks passed
@Zih0 Zih0 deleted the fix/check-collect-util branch March 29, 2026 11:48
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.

1 participant