refactor(TypeScript): Add noImplicitAny
We automatically insert explicit 'any's where needed. These need to be addressed as in #9100. Fixes #4924
This commit is contained in:
@ -69,7 +69,7 @@ function runNgZoneNoLog(fn: () => any) {
|
||||
export function main() {
|
||||
describe("NgZone", () => {
|
||||
|
||||
function createZone(enableLongStackTrace) {
|
||||
function createZone(enableLongStackTrace: any /** TODO #9100 */) {
|
||||
return new NgZone({enableLongStackTrace: enableLongStackTrace});
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ export function main() {
|
||||
|
||||
commonTests();
|
||||
|
||||
it('should produce long stack traces', inject([AsyncTestCompleter], (async) => {
|
||||
it('should produce long stack traces', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => {
|
||||
var c: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
|
||||
@ -112,7 +112,7 @@ export function main() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should produce long stack traces (when using microtasks)',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => {
|
||||
var c: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
|
||||
@ -145,7 +145,7 @@ export function main() {
|
||||
|
||||
commonTests();
|
||||
|
||||
it('should disable long stack traces', inject([AsyncTestCompleter], (async) => {
|
||||
it('should disable long stack traces', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => {
|
||||
var c: PromiseCompleter<any> = PromiseWrapper.completer();
|
||||
|
||||
@ -213,13 +213,13 @@ function commonTests() {
|
||||
});
|
||||
|
||||
describe('run', () => {
|
||||
it('should return the body return value from run', inject([AsyncTestCompleter], (async) => {
|
||||
it('should return the body return value from run', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => { expect(_zone.run(() => { return 6; })).toEqual(6); });
|
||||
|
||||
macroTask(() => { async.done(); });
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty', inject([AsyncTestCompleter], (async) => {
|
||||
it('should call onUnstable and onMicrotaskEmpty', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
macroTask(() => {
|
||||
expect(_log.result()).toEqual('onUnstable; run; onMicrotaskEmpty; onStable');
|
||||
@ -227,7 +227,7 @@ function commonTests() {
|
||||
});
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onStable once at the end of event', inject([AsyncTestCompleter], (async) => {
|
||||
it('should call onStable once at the end of event', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
// The test is set up in a way that causes the zone loop to run onMicrotaskEmpty twice
|
||||
// then verified that onStable is only called once at the end
|
||||
|
||||
@ -251,7 +251,7 @@ function commonTests() {
|
||||
}, resultTimer);
|
||||
}), testTimeout);
|
||||
|
||||
it('should call standalone onStable', inject([AsyncTestCompleter], (async) => {
|
||||
it('should call standalone onStable', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
macroTask(() => {
|
||||
@ -261,7 +261,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
xit('should run subscriber listeners in the subscription zone (outside)',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
// Each subscriber fires a microtask outside the Angular zone. The test
|
||||
// then verifies that those microtasks do not cause additional digests.
|
||||
|
||||
@ -298,7 +298,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should run subscriber listeners in the subscription zone (inside)',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
// the only practical use-case to run a callback inside the zone is
|
||||
@ -320,7 +320,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should run async tasks scheduled inside onStable outside Angular zone',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
ObservableWrapper.subscribe(_zone.onStable, (_) => {
|
||||
@ -336,7 +336,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable once before a turn and onMicrotaskEmpty once after the turn',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('run start');
|
||||
@ -354,7 +354,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('start run');
|
||||
@ -375,7 +375,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should not run onUnstable and onMicrotaskEmpty for nested Zone.run invoked from onMicrotaskEmpty',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('start run')));
|
||||
|
||||
ObservableWrapper.subscribe(_zone.onMicrotaskEmpty, (_) => {
|
||||
@ -393,7 +393,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after each top-level run',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run1')));
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run2')));
|
||||
|
||||
@ -406,7 +406,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after each turn',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
var a: PromiseCompleter<string>;
|
||||
var b: PromiseCompleter<string>;
|
||||
|
||||
@ -437,7 +437,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should run a function outside of the angular zone',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => { _zone.runOutsideAngular(_log.fn('run')); });
|
||||
|
||||
macroTask(() => {
|
||||
@ -447,7 +447,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty when an inner microtask is scheduled from outside angular',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
var completer: PromiseCompleter<any>;
|
||||
|
||||
macroTask(() => {
|
||||
@ -484,7 +484,7 @@ function commonTests() {
|
||||
|
||||
it('should call onUnstable only before executing a microtask scheduled in onMicrotaskEmpty ' +
|
||||
'and not onMicrotaskEmpty after executing the task',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => macroTask(_log.fn('run')));
|
||||
|
||||
var ran = false;
|
||||
@ -516,7 +516,7 @@ function commonTests() {
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty for a scheduleMicroTask in onMicrotaskEmpty triggered by ' +
|
||||
'a scheduleMicroTask in run',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('scheduleMicroTask');
|
||||
@ -551,7 +551,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should execute promises scheduled in onUnstable before promises scheduled in run',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('run start');
|
||||
@ -607,7 +607,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after each turn, respectively',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
var completerA: PromiseCompleter<any>;
|
||||
var completerB: PromiseCompleter<any>;
|
||||
|
||||
@ -639,7 +639,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty before and after (respectively) all turns in a chain',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
runNgZoneNoLog(() => {
|
||||
macroTask(() => {
|
||||
_log.add('run start');
|
||||
@ -660,7 +660,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onUnstable and onMicrotaskEmpty for promises created outside of run body',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
var promise: Promise<any>;
|
||||
|
||||
runNgZoneNoLog(() => {
|
||||
@ -685,7 +685,7 @@ function commonTests() {
|
||||
|
||||
describe('exceptions', () => {
|
||||
it('should call the on error callback when it is invoked via zone.runGuarded',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => {
|
||||
var exception = new BaseException('sync');
|
||||
|
||||
@ -698,7 +698,7 @@ function commonTests() {
|
||||
}), testTimeout);
|
||||
|
||||
it('should not call the on error callback but rethrow when it is invoked via zone.run',
|
||||
inject([AsyncTestCompleter], (async) => {
|
||||
inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
macroTask(() => {
|
||||
var exception = new BaseException('sync');
|
||||
expect(() => _zone.run(() => { throw exception; })).toThrowError('sync');
|
||||
@ -708,7 +708,7 @@ function commonTests() {
|
||||
});
|
||||
}), testTimeout);
|
||||
|
||||
it('should call onError for errors from microtasks', inject([AsyncTestCompleter], (async) => {
|
||||
it('should call onError for errors from microtasks', inject([AsyncTestCompleter], (async: any /** TODO #9100 */) => {
|
||||
var exception = new BaseException('async');
|
||||
|
||||
macroTask(() => { _zone.run(() => { scheduleMicroTask(() => { throw exception; }); }); });
|
||||
|
Reference in New Issue
Block a user