Skip to content

Commit

Permalink
fix(config): make sure that Promise config is undefined initially
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 committed Mar 16, 2018
1 parent dd7c9f1 commit 2213c12
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('Promise' in config).to.be.true;
expect(config.Promise).to.equal(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 2213c12

Please sign in to comment.