Definitelytyped: Compiler error in @types/request-promise

Created on 18 Oct 2017  路  6Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the @types/request-promise package and had problems.
  • [x] I tried using the latest stable version of tsc. https://www.npmjs.com/package/typescript
  • [x] I have a question that is inappropriate for StackOverflow. (Please ask any appropriate questions there).
  • [x] [Mention](https://github.com/blog/821-mention-somebody-they-re-notified) the authors (see Definitions by: in index.d.ts) so they can respond.

    • Authors: @cglantschnig @joeskeen @AyaMorisawa

Currently I can't use `@types/request-promise because it gives a compiler error!

Error at node_modules/@types/request-promise/index.d.ts:13:15: Interface 'RequestPromise' cannot simultaneously extend types 'Request' and 'Bluebird<any>'.
  Named property 'toJSON' of types 'Request' and 'Bluebird<any>' are not identical.

Most helpful comment

I can confirm that with @types/[email protected] and @types/[email protected] it works now also for me. And after tinkering manually I can confirm that at least one of the causes was toJSON(): Object; not being toJSON(): object;.

All 6 comments

Could you check the versions of the packages you're using? For @types/request-promise and @types/bluebird and @types/request. Also try with typescript@next.

I'm having the same error since this morning. Package versions:

@types/[email protected]
@types/[email protected]
@types/[email protected]

Tried with typescript@next, same results.

In file types/bluebird/index.d.ts change the line:
toJSON(): Object;

to

toJSON(): object;

I think you mean in file types/request/index.d.ts

Updating @types/request to 2.0.6 solves it.

EDIT: I also needed to update @types/bluebird to 3.5.16. It's seems that both packages had the definition toJSON(): Object; and at some point they moved to toJSON(): object;

I can confirm that with @types/[email protected] and @types/[email protected] it works now also for me. And after tinkering manually I can confirm that at least one of the causes was toJSON(): Object; not being toJSON(): object;.

Turns out I didn't have @types/bluebird installed (at least not directly). Installing it bumped @types/request to the required version and everything started working. I'm gonna close this :+1:

Was this page helpful?
0 / 5 - 0 ratings