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 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 foo = <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
Expected Result
If the linter wants to report an unsafe destructuring of any
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 as any
, 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