Skip to content

Commit

Permalink
fix(config): make sure that Promise config is undefined initially (#3440
Browse files Browse the repository at this point in the history
)

We need to make sure promise is undefined initially because systems like Zones need to have a chance to pick up Promise and patch it, and we're doing a runtime check for configuration anyhow. This makes the runtime check worthwhile and solves the problem with Zones (without needing to reference Zones in anyway)
  • Loading branch information
benlesh authored Mar 16, 2018
1 parent 7873f8a commit 469afe8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions spec/config-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { config } from '../src/internal/config';
import { expect } from 'chai';

describe('config', () => {
it('should have a Promise property that defaults to nothing', () => {
expect(config).to.have.property('Promise');
expect(config.Promise).to.be.undefined;
});
});
2 changes: 1 addition & 1 deletion src/internal/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export const config = {
* The promise constructor used by default for methods such as
* {@link toPromise} and {@link forEach}
*/
Promise
Promise: undefined as PromiseConstructorLike
};

0 comments on commit 469afe8

Please sign in to comment.