You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lib.es2015.iterable.d.ts exports the Promise interface, which is only used in lib.es2015.iterable.d.ts to help define the PromiseConstructor interface which isn't further used in lib.es2015.iterable.d.ts. Since both Promise and PromiseConstructor are declared in lib.es2015.promise.d.ts and the declaration for Promise in lib.es2015.iterable.d.ts is empty and the declaration for PromiseConstructor is incomplete and not linked to Promise, it seems like both should be removed from the lib.es2015.iterable.d.ts file.
As a result, I got a the compliler error error TS2339: Property 'then' does not exist on type 'Promise<any>'
when I referenced Promise while importing iterable, and not promise instead of the expected error TS2304: Cannot find name 'Promise'
The text was updated successfully, but these errors were encountered:
There is feature crossover here between Promises and Iterables. Some runtimes support one or the other or both or neither. So the --lib option makes it possible to get more granular type checking for your particular target, thanks to declaration merging over multiple lib files.
For example you might be sure to have a Promise polyfill, but don't want to rely on the presence of iterables, so you could include promise.d.ts but not iterable.d.ts. Then you could use promises, but you'd get a compiler error for using Promise.all() with an iterable. Which is better than getting a runtime error.
If you want to use both promises and iterables, then you must include both in your --lib option (or just use es2015 which has both).
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
lib.es2015.iterable.d.ts exports the Promise interface, which is only used in lib.es2015.iterable.d.ts to help define the PromiseConstructor interface which isn't further used in lib.es2015.iterable.d.ts. Since both Promise and PromiseConstructor are declared in lib.es2015.promise.d.ts and the declaration for Promise in lib.es2015.iterable.d.ts is empty and the declaration for PromiseConstructor is incomplete and not linked to Promise, it seems like both should be removed from the lib.es2015.iterable.d.ts file.
As a result, I got a the compliler error
error TS2339: Property 'then' does not exist on type 'Promise<any>'
when I referenced Promise while importing iterable, and not promise instead of the expected
error TS2304: Cannot find name 'Promise'
The text was updated successfully, but these errors were encountered: