次のようにタイプスクリプトの破壊を使用しています。
const props = new Map<User, [Name, Age, Location, Gender]>();
props.set(bill, [n, a, l, g]);
// ...
// Want to access location and gender of bill.
const [n, a, l, g] = props.get(bill);
console.log(l + g);
しかし、これはコンパイラ オプションに違反しているnoUnusedLocals
ため、私が本当に欲しいのは次のとおりです。
const [_, _, l, g] = props.get(bill);
しかし、これはブロックスコープ変数 ( という名前の 2 つの変数_
) の再宣言に違反しています。
これに対処する最善の方法は何ですか?おそらく、ここでの破壊は間違った選択です。