import { PromiseValue } from 'type-fest' ; param fn returns export function exhaustMap < T extends ( ... args : any [ ] ) => Promise < any > > ( fn ) { let lock = false ; return async function ( ... args ) { if ( lock ) { return ; } lock = true ; try { return await fn ( ... args ) ; } finally { lock = false ; } } ; }