-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Open
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
The language and UX around no-unsafe-call (and similar rules) messages indicate "an error 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 have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
Repro Code
const el = /** @type {Element} */ ({})
el.href.includes('abc')ESLint Config
module.exports = {
parser: "@typescript-eslint/parser",
rules: {
"@typescript-eslint/<rule-name>": ["error", ...<options>],
},
};tsconfig
Expected Result
I expected the error message:
Unsafe call of a method on an `any` typed value
Differences:
- mentions the type
any(which is the only observable type in JSDoc withoutcheckJs: true) - doesn't mention the type
error - less important: mentions "method"
Actual Result
I observed the error message:
Unsafe call of an `error` type typed value
Confusing parts:
- no mention of
any - mentions the type
error, which is unobservable in JSDoc withoutcheckJs: true- also, if I hear "an
errortype 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
- also, if I hear "an
- less important: does not mention "method"
Using this in TypeScript or with checkJs: true leads to a more understandable experience:
Hovering over href in el.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 the ts-api-utils function isIntrinsicErrorType
kirkwaiblinger, Ilanaya, vimalloc, Dennis273, normanzb and 10 moredandv, Paliao, Ajanth and otto-dev
Metadata
Metadata
Assignees
Labels
accepting prsGo ahead, send a pull request that resolves this issueGo ahead, send a pull request that resolves this issueenhancementNew feature or requestNew feature or requestpackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin


{ "compilerOptions": { } }