Skip to content

Commit

Permalink
[watcher] fix invalid import (#116907) (#117238)
Browse files Browse the repository at this point in the history
Co-authored-by: spalger <[email protected]>
Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Spencer <[email protected]>
Co-authored-by: spalger <[email protected]>
  • Loading branch information
3 people authored Nov 2, 2021
1 parent 8754994 commit b371b83
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import dateMath from '@elastic/datemath';

import { parseEsInterval } from './index';
import { parseEsInterval } from './parse_es_interval';

const unitsDesc = dateMath.unitsDesc;
const largeMax = unitsDesc.indexOf('M');
Expand All @@ -17,10 +17,9 @@ const largeMax = unitsDesc.indexOf('M');
* compatible expression, and provide
* associated metadata
*
* @param {moment.duration} duration
* @return {object}
* @param duration
*/
export function convertDurationToNormalizedEsInterval(duration) {
export function convertDurationToNormalizedEsInterval(duration: moment.Duration) {
for (let i = 0; i < unitsDesc.length; i++) {
const unit = unitsDesc[i];
const val = duration.as(unit);
Expand All @@ -35,7 +34,7 @@ export function convertDurationToNormalizedEsInterval(duration) {

return {
value: val,
unit: unit,
unit,
expression: val + unit,
};
}
Expand All @@ -49,7 +48,7 @@ export function convertDurationToNormalizedEsInterval(duration) {
};
}

export function convertIntervalToEsInterval(interval) {
export function convertIntervalToEsInterval(interval: string) {
const { value, unit } = parseEsInterval(interval);
return {
value,
Expand Down

0 comments on commit b371b83

Please sign in to comment.