elastic / kibana

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

[TimeFilter] Cleanup incorrect types #160824

Open lukasolson opened 1 year ago

lukasolson commented 1 year ago

As seen in https://github.com/elastic/kibana/pull/160456#pullrequestreview-1502640062, the types in TimeFilter sometimes don't match the runtime types. In some cases we are returning moment values when we should be returning strings. We should clean these up so that they actually properly reflect the runtime types.

In the end we should consolidate both InputTimeRange and TimeRange:

export type TimeRange = {
  from: string;
  to: string;
  mode?: 'absolute' | 'relative';
};

export type InputTimeRange =
  | TimeRange
  | {
      from: Moment;
      to: Moment;
    };
elasticmachine commented 1 year ago

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