param callback hidden export function onlyOnce < T > ( callback ) { var called = false ; return ( err ? ) => { if ( called ) throw new Error ( "Callback was already called." ) ; called = true ; callback ( err ) ; } ; } export interface Callback { ( err ? ) : void ; } export interface ResultCallback < T > { ( err ? , result ? ) : void ; } export interface IteratorCallback < T > { ( item , callback ) : any ; }