/**
 * Chains two functions for further assigning as one wrapped callback function
 */ export function chainCallbacks < T extends ( this : unknown , ... args : any [ ] ) => any > ( f1 , f2 ) { return function ( this , ... args ) : ReturnType < T > { if ( f1 ) { f1 . apply ( this , args ) ; } return f2 . apply ( this , args ) ; } as T ; }