You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: a modifier on a field named like an Object.prototype member throws at decoration #47
attachModifier (src/modifiers/common.ts) decides whether a field already has modifiers with field in metaTable.fields. in also answers for inherited keys, so for a field named toString, valueOf, hasOwnProperty, isPrototypeOf, propertyIsEnumerable, toLocaleString or constructor it takes the "already modified" branch, reads Object.prototype[field] as the modifier list, and throws.
Reproduction
On main (0.1.11, pnpm run build first):
constlib=require("./dist/index.js");classTextendslib.Table.with(lib.LocalizationModifier){}lib.Localized()(T.prototype,"toString");// TypeError: Cannot read properties of undefined (reading 'modifier')classUextendslib.Table.with(lib.HashModifier){}lib.Hashed()(U.prototype,"valueOf");// TypeError: Cannot read properties of undefined (reading 'modifier')
With TypeScript decorators the same happens for @Localized() toString!: ... at class definition time.
Expected
The field gets its first modifier like any other name, or the decorator refuses the name with a clear error.
Notes
The same inherited-key lookup appears in ignoredEventNames (event in ignoredEventNames, src/modifiers/internal/kinds.ts), which silently skips modifier methods named like Object.prototype members as events. An own-key check (Object.hasOwn) or a Map fixes both, which is a behaviour change, so it was left out of the residual sweep refactor.
Fixed by #53 (look up modified fields and event names by own key), landed on main (921bf9d, the landed campaign/integration PR #87). Checked on main with the issue's repro: @Localized on toString and @Hashed on valueOf no longer throw; src/tests/own_key_lookups.test.ts passes.
Activity
Upd4ting commentedon Nov 4, 2026
Fixed by #53 (look up modified fields and event names by own key), landed on main (921bf9d, the landed campaign/integration PR #87). Checked on main with the issue's repro: @Localized on toString and @Hashed on valueOf no longer throw; src/tests/own_key_lookups.test.ts passes.