Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 701 Bytes

require-typed-object-values-and-entries.md

File metadata and controls

24 lines (15 loc) · 701 Bytes

Require Object.values() and Object.entries() calls to have generic type specified (@sofie-automation/require-typed-object-values-and-entries)

💼 This rule is enabled in the 🌐 all config.

This enforces that explicit typings must be provided to Object.values and Object.entries calls.
Sometimes Typescript will determine that the output type is any, often if an invalid object is supplied, this will let typescript to a type check to make sure the input object matches the requested output type

❌ Incorrect

Object.values(a)

Object.entries(a)

✅ Correct

Object.values<string>(a)

Object.entries<string>(a)