Created
          May 19, 2019 00:46 
        
      - 
      
 - 
        
Save sebastiankade/26f6b8263f005cb6259a11b55a81ec97 to your computer and use it in GitHub Desktop.  
    Typescript wrapper for node util promisify
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import * as util from "util"; | |
| type Maybe<T> = T | undefined | null; | |
| export function promisify<Args, R>( | |
| fn: (arg: Args, callback: (e: Maybe<Error>, result: R) => void) => void, | |
| self?: any | |
| ): (arg: Args) => Promise<R> { | |
| return util.promisify(fn).bind(self); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment