8000
Skip to content

Fix JS typecheck failures introduced by TypeScript v6 strict catch variable typing#24089

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-js-tests
Apr 2, 2026
Merged

Fix JS typecheck failures introduced by TypeScript v6 strict catch variable typing#24089
pelikhan merged 2 commits intomainfrom
copilot/fix-js-tests

Conversation

Copy link
Copy Markdown
Contributor
Copilot AI commented Apr 2, 2026

TypeScript v6 with strict: true enables useUnknownInCatchVariables, typing catch clause variables as unknown instead of any. This broke two existing patterns in the codebase.

Changes

  • tsconfig.json: Add "useUnknownInCatchVariables": false — consistent with the existing "noImplicitAny": false override pattern; catch variables were never intended to be unknown here
  • parse_mcp_gateway_log.cjs: Add | null to generateTokenUsageSummary's JSDoc param type — parseTokenUsageJsonl can return null (zero requests case), and the function already guards against it
  • add_comment.cjs, check_permissions_utils.cjs: Remove 4 @ts-expect-error directives on error?.status accesses — no longer errors now that catch variables are any

Copilot AI and others added 2 commits April 2, 2026 11:57
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/640c79c0-79bb-47b3-883d-6b55c4c10f7b

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review April 2, 2026 12:06
Copilot AI review requested due to automatic review settings April 2, 2026 12:06
@pelikhan pelikhan merged commit f9b73c4 into main Apr 2, 2026
52 checks passed
@pelikhan pelikhan deleted the copilot/fix-js-tests branch April 2, 2026 12:07
Copy link
Copy Markdown
Contributor
Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves JavaScript @ts-check typecheck failures caused by TypeScript v6’s stricter default typing of catch variables (as unknown) under strict: true.

Changes:

  • Disable useUnknownInCatchVariables in the JS tsconfig.json used for checkJs.
  • Update JSDoc in parse_mcp_gateway_log.cjs to reflect that the token-usage summary can be null.
  • Remove now-unnecessary @ts-expect-error directives for error?.status checks in two scripts.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
actions/setup/js/tsconfig.json Disables useUnknownInCatchVariables to restore prior catch variable typing behavior under @ts-check.
actions/setup/js/parse_mcp_gateway_log.cjs Aligns generateTokenUsageSummary JSDoc with the null return possibility from parseTokenUsageJsonl.
actions/setup/js/check_permissions_utils.cjs Removes @ts-expect-error directives that are no longer needed after reverting catch-variable typing.
actions/setup/js/add_comment.cjs Removes @ts-expect-error directives for error?.status accesses in error handling paths.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

0