Summary
The usage bar translator in src/auto-reply/usage-bar/translator.ts uses key in table for alias vocabulary lookup (line 133) and segment case table lookup (line 203). The in operator traverses the prototype chain, so keys like toString, valueOf, constructor incorrectly match Object.prototype properties instead of falling through to the intended fallback/default behavior.
Reproduction
When a usage template has an alias table or map case table, and the lookup key is "toString" or "constructor", in returns true even when those are not own properties.
Expected
Use Object.hasOwn(table, key) (ES2022) to check only own properties.
Scope
src/auto-reply/usage-bar/translator.ts:133,203 — 1 file, 2 lines.
Summary
The usage bar translator in
src/auto-reply/usage-bar/translator.tsuseskey in tablefor alias vocabulary lookup (line 133) and segment case table lookup (line 203). Theinoperator traverses the prototype chain, so keys liketoString,valueOf,constructorincorrectly matchObject.prototypeproperties instead of falling through to the intended fallback/default behavior.Reproduction
When a usage template has an alias table or map case table, and the lookup key is
"toString"or"constructor",inreturns true even when those are not own properties.Expected
Use
Object.hasOwn(table, key)(ES2022) to check only own properties.Scope
src/auto-reply/usage-bar/translator.ts:133,203— 1 file, 2 lines.