Skip to content

Avoid specifying error type since the default is unknown #4086

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2025

Conversation

robertbrignull
Copy link
Contributor

@robertbrignull robertbrignull commented Jul 22, 2025

Since typescript 4.4 (release notes), values in a catch default to the unknown type. So we don't need to specify it, and there were a couple of places where we were explicitly using any that would be better off as unknown.

Discovered while working on #4056

@Copilot Copilot AI review requested due to automatic review settings July 22, 2025 16:46
@robertbrignull robertbrignull requested review from a team as code owners July 22, 2025 16:46
Copy link

@Copilot 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 updates TypeScript catch clauses to leverage the default unknown type introduced in TypeScript 4.4, removing explicit type annotations and replacing instances where any was used with the more type-safe default behavior.

  • Removes explicit : unknown type annotations from catch clauses since they're now the default
  • Updates test code to use getErrorMessage() helper instead of directly accessing .message property on error objects
  • Improves type safety by avoiding explicit any typing in catch blocks

Reviewed Changes

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

Show a summary per file
File Description
variant-analysis-manager.test.ts Updates test catch blocks to use getErrorMessage() helper and removes explicit any typing
errors.test.ts Removes explicit : unknown annotation from catch clause
variant-analysis-manager.ts Removes explicit : unknown annotation from catch clause
model-editor-view.ts Removes explicit : unknown annotations from multiple catch clauses
extension-pack-picker.ts Removes explicit : unknown annotation from catch clause
summary-language-support.ts Removes explicit : unknown annotation from catch clause
skeleton-query-wizard.ts Removes explicit : unknown annotations from multiple catch clauses
extension.ts Removes explicit : unknown annotation from catch clause
db-panel.ts Removes explicit : unknown annotation from catch clause
database-manager.ts Removes explicit : unknown annotation from catch clause
local-databases-ui.ts Removes explicit : unknown annotation from catch clause
short-paths.ts Removes explicit : unknown annotation from catch clause
distribution.ts Removes explicit : unknown annotation from catch clause
update-node-version.ts Removes explicit : unknown annotation from catch clause
source-map.ts Removes explicit : unknown annotation from catch clause

Copy link
Member

@koesie10 koesie10 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@robertbrignull robertbrignull merged commit cc86563 into main Jul 23, 2025
33 of 34 checks passed
@robertbrignull robertbrignull deleted the robertbrignull/error-unknown branch July 23, 2025 08:20
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.

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy