Skip to content

fix: remove unnecessary any type from catch clause in github.ts - #24504

Closed
alfredocristofano wants to merge 3 commits into
anomalyco:devfrom
alfredocristofano:contrib/cristofano-github
Closed

alfredocristofano wants to merge 3 commits into
anomalyco:devfrom
alfredocristofano:contrib/cristofano-github

Conversation

@alfredocristofano

@alfredocristofano alfredocristofano commented Apr 26, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #24327

Type of change

  • Refactor / code improvement

What does this PR do?

Removes an unnecessary any type annotation from a catch clause in src/cli/cmd/github.ts (line 689).

The project style guide prohibits any ("Avoid any; prefer precise types"). The existing code already safely handles the caught value with instanceof checks (Process.RunFailedError, Error), so the any annotation provides no value and disables type checking.

How did you verify your code works?

  • The catch block already uses e instanceof Error and e instanceof Process.RunFailedError before accessing Error-specific properties
  • Removing : any lets TypeScript infer unknown, which is the correct type for caught values
  • No behavioral change — purely a type safety improvement

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR
  • I have read the CONTRIBUTING.md guidelines

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

I found a potentially related PR:

PR #24503: fix: replace catch (e: any) with proper unknown handling in mcp/index.ts

This PR addresses the same style guide violation (removing unnecessary any type from catch clauses) but in a different file (mcp/index.ts instead of github.ts). These are related refactoring efforts to improve type safety across the codebase, though they target different files and are not duplicates of each other.

@github-actions github-actions Bot removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels Apr 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@alfredocristofano

Copy link
Copy Markdown
Author

Closing this one myself. The branch picked up a large unrelated diff and now shows conflicts, so it is not useful for review in its current form. I’ll keep the issue open for a cleaner fix.

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.

[BUG] ~30 catch blocks silently swallow errors across core modules

1 participant