microsoft / tslib

Runtime library for TypeScript helpers.
BSD Zero Clause License
1.26k stars 128 forks source link

Do you need to polyfill promises? #36

Closed matthewmueller closed 6 years ago

matthewmueller commented 7 years ago

It seems like this library depends on window.Promise being available. Is that true? Are there any other requirements for this library?

DanielRosenwasser commented 7 years ago

Yes, the library expects an implementation or a polyfill. If you use async iterators, you'll need Symbol.asyncIterator.

matthewmueller commented 7 years ago

Okay good to know! It'd be great to either document that somewhere or even better provide the polyfills via tslib (npm's promise-polyfill is tiny).

Currently it's a bit confusing when the target in tsconfig says "es3" and the typescript language permits async, but then your code doesn't work in IE11.

I think typescript providing a stable language with cross-browser support would be sooo huge.

NeoLegends commented 6 years ago

even better provide the polyfills via tslib

I am absolutely against that. Please polyfill yourself according to the browser targets you want to support, but don't put the additional library bloat on everyone by automatically polyfilling everything.

fis-cz commented 6 years ago

Just opened another discussion, what should be filled or polyfilled by ts and what should not. see 25027