[js-api-parser] Fix constructor rendering for destructured parameters#14451
[js-api-parser] Fix constructor rendering for destructured parameters#14451
Conversation
|
@copilot resolve merge conflicts |
|
@copilot Rebase the branch with the latest on main and resolve the merge conflicts. |
Done in bd9adce — synced the branch with the latest main (minimatch bump, sdk-testgen ESLint migration to flat config, azsdk-cli codeowners updates, and dependency bumps across tsp-client, js-sdk-release-tools, typespec-bump-deps). Only the constructor fix remains as a delta from main. All 312 tests pass. |
bd9adce to
f84b302
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the JS APIView parser (js-api-parser) to avoid emitting invalid constructor signatures when API Extractor reports destructured parameters, and adds a unit test to cover the scenario. It also includes a package-lock.json refresh from rebasing/syncing with main.
Changes:
- Skip destructured constructor parameters (names starting with
{) so only the synthetic normalized parameter is rendered. - Add a unit test covering the destructured-parameter constructor case.
- Update
package-lock.jsonwith refreshed dependency resolutions.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/apiview/parsers/js-api-parser/src/tokenGenerators/constructor.ts | Filters out destructured parameters before token emission. |
| tools/apiview/parsers/js-api-parser/test/tokenGenerators/constructor.spec.ts | Adds a test to ensure destructured parameters are skipped. |
| tools/apiview/parsers/js-api-parser/package-lock.json | Updates dependency lockfile after rebase/sync. |
Files not reviewed (1)
- tools/apiview/parsers/js-api-parser/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)
tools/apiview/parsers/js-api-parser/package-lock.json:2739
rimraf@6.1.2(and its dependencyglob@13) declaresengines.nodeas20 || >=22. The js-api-parser CI pipeline is configured to use Node 18.x, and the build script runsrimrafvianpm run clean, so this lockfile update risks breaking CI/builds under Node 18. Consider pinningrimraf/globto versions that support Node 18, or updating the pipeline/tool’s supported Node version to 20+ and documenting it.
tools/apiview/parsers/js-api-parser/src/tokenGenerators/constructor.ts
Outdated
Show resolved
Hide resolved
tools/apiview/parsers/js-api-parser/test/tokenGenerators/constructor.spec.ts
Show resolved
Hide resolved
…ring Co-authored-by: KarishmaGhiya <8968058+KarishmaGhiya@users.noreply.github.com>
…uctor.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ic excerptText Co-authored-by: KarishmaGhiya <8968058+KarishmaGhiya@users.noreply.github.com>
a358d8e to
20b6825
Compare
{)excerptTextto the real API Extractor constructor signature sogetParameterPropertyModifiersexercises the TypeScript AST parsing path, and add precise assertions (no stray commas/colons)Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.