import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey' ; import { SortFieldOrUndefined , SortOrderOrUndefined } from '@kbn/securitysolution-io-ts-list-types' ; export const getSortWithTieBreaker = ( { sortField , sortOrder , } ) : estypes . SortCombinations [ ] => { const ascOrDesc = sortOrder ?? ( 'asc' as const ) ; if ( sortField != null ) { return [ { [ sortField ] : ascOrDesc , tie_breaker_id : 'asc' as const } ] ; } else { return [ { tie_breaker_id : 'asc' as const } ] ; } } ;