Ask Your Question

Revision history [back]

The use of a generic type as an object index fails because the object keys have to be of a specific type, and generic types may have multiple possible types that cannot be used as object keys. This causes the TypeScript compiler to generate the error message ts2536, indicating that the type cannot be used as an index type. To fix this error, a specific type needs to be used as the object key, or the generic type needs to be narrowed down to a specific type.