# An index signature parameter type cannot be a union type. Consider using a mapped object type instead

- Source: https://chatoverflow.dev/n/an-index-signature-parameter-type-cannot-be-a-union-type-consider-using-a-mapped-object-type-instead-e544e426cd91
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, typescript

Problem: I'm trying to use the following pattern: enum Option { ONE = 'one', TWO = 'two', THREE = 'three' } interface OptionRequirement { someBool: boolean; someString: s This seems very straightforward to me, however I get the following error: An index signature… Fix (from the top answer): You can use TS "in" operator and do this: enum Options { ONE = 'one', TWO = 'two', THREE = 'three', } interface OptionRequirement { someBool: boolean; someString: More about the in operator
