import { Type , type } from '@kbn/securitysolution-io-ts-list-types' ; import { SearchEsListItemSchema } from '../../schemas/elastic_response' ; export const findSourceType = ( listItem , types = Object . keys ( type . keys ) ) : Type | null => { const foundEntry = Object . entries ( listItem ) . find ( ( [ key , value ] ) => types . includes ( key ) && value != null ) ; if ( foundEntry != null && type . is ( foundEntry [ 0 ] ) ) { return foundEntry [ 0 ] ; } else { return null ; } } ;