Fix JS typecheck failures introduced by TypeScript v6 strict catch variable typing#24089
Merged
Fix JS typecheck failures introduced by TypeScript v6 strict catch variable typing#24089
Conversation
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>
…Variables 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>
Copilot created this pull request from a session on behalf of
pelikhan
April 2, 2026 12:06
View session
Contributor
There was a problem hiding this comment.
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
useUnknownInCatchVariablesin the JStsconfig.jsonused forcheckJs. - Update JSDoc in
parse_mcp_gateway_log.cjsto reflect that the token-usage summary can benull. - Remove now-unnecessary
@ts-expect-errordirectives forerror?.statuschecks 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TypeScript v6 with
strict: trueenablesuseUnknownInCatchVariables, typing catch clause variables asunknowninstead ofany. This broke two existing patterns in the codebase.Changes
tsconfig.json: Add"useUnknownInCatchVariables": false— consistent with the existing"noImplicitAny": falseoverride pattern; catch variables were never intended to beunknownhereparse_mcp_gateway_log.cjs: Add| nulltogenerateTokenUsageSummary's JSDoc param type —parseTokenUsageJsonlcan returnnull(zero requests case), and the function already guards against itadd_comment.cjs,check_permissions_utils.cjs: Remove 4@ts-expect-errordirectives onerror?.statusaccesses — no longer errors now that catch variables areany