Saturday, 6 May 2017

Is there any way to promisify node's functions and get intellisense with Typescript?

I'm using @types definitions and added @types/bluebird, as expected I get autocomplete when using the methods from the library. However I would like to promisify node's functions (fs). I'm able to do that with the following line:

import * as Promise from 'bluebird'
import * as fs from 'fs'

const fsPromisified = Promise.promisifyAll(fs)

The problem is that when I do fsPromisified I lose autocomplete.

Is there any way I can do this without having to wrap around node's functions myself with promises?



via César Alberca

No comments:

Post a Comment