import { ReactTestInstance } from "react-test-renderer" ; import wait from "./wait" ; interface Options { timeout ? : number ; interval ? : number ; } export default async function waitForElement ( callback , options ? ) { let result = null ; await wait ( ( ) => { result = callback ( ) ; if ( ! result ) { throw new Error ( ) ; } } , options ) ; return result ! ; }