I installed the request-promise library and tried to use it in my TypeScript application, but without much luck.
If I use it as follows:
import {RequestPromise} from'request-promise'; RequestPromise('http://www.google.com') .then(function (htmlString) {
I see this at the output of TS compilation:
error TS2304: Cannot find name 'RequestPromise'.
If I use it as follows:
import * as rp from'request-promise'; rp('http://www.google.com') .then(function (htmlString) {
I see an error that says the .then () method is missing on the rp object.
How to use it correctly with TypeScript?
source share