param fn export function countTime ( fn ) ; export function countTime ( fn ) ; export function countTime < T extends ( ) => Promise < void > | void > ( fn ) { const start = Date . now ( ) ; const res = fn ( ) ; if ( res instanceof Promise ) { return res . then ( ( ) => Date . now ( ) - start ) ; } return Date . now ( ) - start ; }