elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.67k stars 8.23k forks source link

[Discover] Improve types handling for saved search embeddable: legacy table props vs grid props #163804

Closed jughosta closed 9 months ago

jughosta commented 1 year ago

Currently, props from table components are being combined into SearchProps type and they remain optional https://github.com/elastic/kibana/blob/c97d4960bf995671c7053333236ae7ff47fcc7a4/src/plugins/discover/public/embeddable/saved_search_embeddable.tsx#L81-L82

and then we try to split them by casting types: https://github.com/elastic/kibana/blob/2bee02ffd088a2f3fd6a74f0b5efadf43a7085b2/src/plugins/discover/public/embeddable/saved_search_embeddable_component.tsx#L35 and https://github.com/elastic/kibana/blob/2bee02ffd088a2f3fd6a74f0b5efadf43a7085b2/src/plugins/discover/public/embeddable/saved_search_embeddable_component.tsx#L42

We can't reply on type casting as it suppresses errors in misconfigured props. We better have stricter type checking to prevent unexpected situations.

elasticmachine commented 1 year ago

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)