Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: [no-unsafe-call] Unclear message "Unsafe call of anerror type typed value" (especially in JSDoc) #9591

Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin
@karlhorky

Description

@karlhorky

The language and UX aroundno-unsafe-call (and similar rules) messages indicate "anerror type typed value", which seems unclear and maybe also misleading.

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.
  • I havesearched for related issues and found none that matched my issue.
  • I haveread the FAQ and my problem is not listed.

Playground Link

https://typescript-eslint.io/play/#ts=5.5.2&fileType=.js&code=MYewdgzgLgBApgGxgXhgegFQZgASgTwAc4YBvAUQTgFs4woBfGDNGAClIYEoAoHxAHQALAE5wAZgICWYYAgCuAEzgQ2AcgCGAI2BreQA&eslintrc=N4KABGBEBOCuA2BTAzpAXGUEKQAIBcBPABxQGNoBLY-AWhXkoDt8B6Jge1tieQEMAZolpk%2B8eOiiJo0DtEjgwAXxBKgA&tsconfig=&tokens=false

Repro Code

constel=/**@type {Element} */({})el.href.includes('abc')

Screenshot of typescript-eslint playground, showing IntelliSense hover with the message "Unsafe call of an error type typed value"

ESLint Config

module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/<rule-name>":["error", ...<options>],},};

tsconfig

{"compilerOptions": {  }}

Expected Result

I expected the error message:

Unsafe call of a method on an `any` typed value

Differences:

  • mentions the typeany (which is the only observable type in JSDoc withoutcheckJs: true)
  • doesn't mention the typeerror
  • less important: mentions "method"

Actual Result

I observed the error message:

Unsafe call of an `error` type typed value

Confusing parts:

  • no mention ofany
  • mentions the typeerror, which is unobservable in JSDoc withoutcheckJs: true
    • also, if I hear "anerror type typed value", then that could sound like something likeError, so even if this "error" language is kept in some form, maybe it should be disambiguated fromError
  • less important: does not mention "method"

Using this in TypeScript or withcheckJs: true leads to a more understandable experience:

IntelliSense hover over "href" showing the error message "Property 'href' does not exist on type 'Element'."

Hovering overhref inel.href shows that TypeScript is reporting an error:

Property 'href' does not exist on type 'Element'.

Additional Info

This also affects other rules, since they also create messages the same way.

The type for this seems to be coming from thets-api-utils functionisIntrinsicErrorType

cc@JoshuaKGoldberg

Metadata

Metadata

Assignees

No one assigned

    Labels

    accepting prsGo ahead, send a pull request that resolves this issueenhancementNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp