refactor: ensure zone.js can be built with typescript strict flag (#30993)

As part of FW-1265, the `zone.js` package is made compatible
with the TypeScript `--strict` flag. Read more about the strict flag [here](https://www.typescriptlang.org/docs/handbook/compiler-options.html)

PR Close #30993
This commit is contained in:
Paul Gschwendtner
2019-06-26 10:33:02 +02:00
committed by Miško Hevery
parent 10a1e1974b
commit 60f58bf051
20 changed files with 77 additions and 66 deletions

View File

@ -13,7 +13,8 @@ const detectTask = Zone.current.scheduleMacroTask('detectTask', noop, undefined,
const originalTransitionTo = detectTask.constructor.prototype._transitionTo;
// patch _transitionTo of ZoneTask to add log for test
const logTransitionTo: Function = function(
toState: TaskState, fromState1: TaskState, fromState2?: TaskState) {
this: Task&{_state: TaskState}, toState: TaskState, fromState1: TaskState,
fromState2?: TaskState) {
log.push({
zone: Zone.current.name,
taskZone: this.zone && this.zone.name,
@ -24,7 +25,7 @@ const logTransitionTo: Function = function(
};
function testFnWithLoggedTransitionTo(testFn: Function) {
return function() {
return function(this: unknown) {
detectTask.constructor.prototype._transitionTo = logTransitionTo;
testFn.apply(this, arguments);
detectTask.constructor.prototype._transitionTo = originalTransitionTo;