# no-unsafe-property-key πŸ“ Disallow unsafe values as property keys. πŸ’ΌπŸš« This rule is enabled in the βœ… `recommended` [config](https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config). This rule is _disabled_ in the β˜‘οΈ `unopinionated` [config](https://github.com/sindresorhus/eslint-plugin-unicorn#recommended-config). JavaScript property keys are strings or symbols. Other values used as property keys are coerced first. This can hide bugs when objects become `"[object Object]"`, arrays become joined strings, BigInts become string keys without the `n` suffix, or unsafe and non-finite numbers become surprising string keys. Use an explicit string or symbol key when stringification is intended. Use `Map` or `WeakMap` when object identity is the key. The rule uses static values, TypeScript annotations, and TypeScript type information when available. It intentionally allows common safe numeric indexing like `array[0]`. ## Examples ```js // ❌ const key = {}; object[key] = value; // βœ… object[String(key)] = value; ``` ```js // ❌ const key = []; const object = { [key]: value, }; // βœ… const object = { [key.join('')]: value, }; ``` ```js // ❌ array[4n] = value; // βœ… array[Number(4n)] = value; ``` ```js // ❌ const object = { 9007199254740992: value, }; // βœ… const object = { '9007199254740992': value, }; ``` ```js // ❌ const object = { [{}]: value, }; // βœ… const map = new Map([ [{}, value], ]); ```