import asyncWait from './asyncWait' const asyncTimeout = (fn: () => Promise, ms: number) => { return Promise.race([ fn(), async () => { await asyncWait(ms) throw new Error('timeout') }, ]) } export default asyncTimeout