FAO @gustavohenke
I'm using request-promise-native 1.0.5. When I tried using @types/request-promise-native 1.0.12 I saw the following compile error:
Property '[Symbol.toStringTag]' is missing in type 'RequestPromise'.
I think TSC believes request-promise-native is returning a "Promise-like" rather than a Promise
.
This issue does not exist with @types/request-promise-native 1.0.10
Same problem here with request-promise-native 1.0.5. Downgrading typing to 1.0.10 works.
See #23087, cc @mastermatt
This is correct, request-promise-native
does not return a Promise
.
Check the PR linked above for a description and links to relevant code.
const rp = requestPromise.get("http://github.com");
console.log(typeof rp); // object
console.log(Object.prototype.toString.call(rp)); // [object Object]
console.log(rp.toString()); // [object Object]
console.log(rp.toStringTag); // undefined
console.log(rp.promise().toString()); // [object Promise]
If you need access to the underlying Promise
, use rp.promise()
.
Most helpful comment
This is correct,
request-promise-native
does not return aPromise
.Check the PR linked above for a description and links to relevant code.
If you need access to the underlying
Promise
, userp.promise()
.