stefanpenner / es6-promise

A polyfill for ES6-style Promises
MIT License
7.3k stars 593 forks source link

typing issue? #300

Closed arvind1234 closed 6 years ago

arvind1234 commented 6 years ago

I think there might an issue with the typings (Typescript > 2.4.x ) - do correct me if I'm wrong. But when I return a ES6Promise when a native Promise is expected - I get a TS compiler error saying ... "Property '[Symbol.toStringTag]' is missing in type 'Promise'." ...

There is more to the error, but I'm just pasting the last line. So, here I'm returning a ES6Promise when a Promise is expected.

stefanpenner commented 6 years ago

It seems like the typings expecting Symbol.toStringTag are too strict. Rather they should merely expect something with then is returned. Promises are designed to inter-opt entirely on the existing of then function member.

It isn't clear to me that there is a problem with this library, if I have misunderstood something please share further details so my misunderstanding can be fixed