import { PromiseValue } from 'type-fest' ; param num param fn returns export function repeatedCall < T extends ( i : number ) => Promise < any > > ( fn , num ) ; export function repeatedCall < T extends ( i : number ) => any > ( fn , num ) ; export function repeatedCall < T extends ( i : number ) => any > ( fn , num ) { const res = Array ( num ) . fill ( 0 ) . map ( ( _ , i ) => fn ( i ) ) ; if ( num > 0 && res [ 0 ] instanceof Promise ) { return Promise . all ( res ) ; } return res ; }