Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
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
Repro Code
constfoo=<T,>(data:T)=>({ data,isEmpty:!data});const{ data}=foo(JSON.parse('{}'));
ESLint Config
module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/no-unsafe-assignment":"error",},};
tsconfig
{"compilerOptions": {// ... }}
Expected Result
If the linter wants to report an unsafe destructuring ofany
type, the message should clearly indicate it’s due to destructuring from an object, not an array or tuple.
Actual Result
The code produces the following error:
Unsafe array destructuring of a tuple element with an `any` value
data
is inferred asany
, which makes sense and it's fair for the rule to report that.
What doesn't make sense is the error message — it's an object destructuring, not an array. The message is confusing and makes it sound like a tuple or array is involved, when it's clearly just pulling a property off an object.
Additional Info
No response