typescript/no-dynamic-delete Restriction β
What it does β
Disallow using the delete operator on computed key expressions.
Why is this bad? β
Deleting dynamically computed keys can be dangerous and in some cases not well optimized. Using the delete operator on keys that aren't runtime constants could be a sign that you're using the wrong data structures. Consider using a Map or Set if youβre using an object as a key-value collection.
Example β
ts
const container: { [i: string]: 0 } = {};
delete container["aa" + "b"];