- Notifications
You must be signed in to change notification settings - Fork 115
Closed
Labels
Description
🐛 Wrong type
The ilm.explainLifecycle response's indices property is typed as Record<string, IlmExplainLifecycleLifecycleExplain> | IlmExplainLifecycleLifecycleExplainProject.
Definition
If I try to access indices[indexName], TS complains with this error:
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Record<string, IlmExplainLifecycleLifecycleExplain> | IlmExplainLifecycleLifecycleExplainProject'. No index signature with a parameter of type 'string' was found on type 'Record<string, IlmExplainLifecycleLifecycleExplain> | IlmExplainLifecycleLifecycleExplainProject'.ts(7053) This is defined in https://github.com/elastic/elasticsearch-specification/blob/main/specification/ilm/explain_lifecycle/ExplainLifecycleResponse.ts#L26.
Based on the Explain lifecycle API docs, I don't see how LifecycleExplainProject could be relevant to the response. I believe the correct type is:
export class Response { body: { - indices: Dictionary<IndexName, LifecycleExplain> | LifecycleExplainProject + indices: Dictionary<IndexName, LifecycleExplain> } }