[我们想检测(以ESlint或打字稿为例)Typescript中解构参数类型中未使用的属性,例如下面的示例中的“ c”
const myIncompletelyRefactoredFunction = ({a, b}: {a: number, b: number, c: number}) => a + b
No-unused-var允许我们检测诸如以下情况:
//ts-error
const myIncompletelyRefactoredFunction = ({a, b, c}: {a: number, b: number, c: number}) => a + b
但是在这种情况下重构还没有完成,我们想检测一下。
我们的用例是带有数十个道具的React组件,尽管不再使用它们,但类型仍然需要道具
谢谢
有人在这里为您的用例提出了规则建议:https://github.com/typescript-eslint/typescript-eslint/issues/1529
享受!