Auth0 Home Blog Docs

Type 'Bluebird<string>' is not assignable to type 'Promise<string>' error when using Typescript

auth0-server
typescript

#1

This applies to the Auth0 Javascript SDK v2.13.0 on a Node 10.5.0

I just switched to Typescript (v3.1.6) and am converting a JS file over. I’m using the auth0 SDK and I installed the latest @types/auth0.

When trying to compile my code, I get the following error:

Type 'Bluebird<string>' is not assignable to type 'Promise<string>'.
  Property '[Symbol.toStringTag]' is missing in type 'Bluebird<string>'.

Looking at the Types file, I can see that it imports Promise from bluebird… but I’m not using bluebird, I’m using the native Promise class.

So, how do I do this? Do I need to take and modify the Types file myself?


#2

Hey Dan! I’m not using @types/auth0 but I have used both @types/auth0-js and @types/auth0-lock and I have had to make some manual changes to the types (they were missing some options). My guess would be that the types files are not that well-maintained. So I wouldn’t hesitate to change things as needed.