diff --git a/src/schedulers/NextTickAction.ts b/src/schedulers/NextTickAction.ts index 0a883c6672..729c53ffc1 100644 --- a/src/schedulers/NextTickAction.ts +++ b/src/schedulers/NextTickAction.ts @@ -4,8 +4,7 @@ import ImmediateAction from './ImmediateAction'; import Action from './Action'; export default class NextTickAction extends ImmediateAction { - - id: number; + private id: any; schedule(state?: any): Action { if (this.isUnsubscribed) { @@ -21,7 +20,7 @@ export default class NextTickAction extends ImmediateAction { if (!scheduler.scheduled) { scheduler.scheduled = true; this.id = Immediate.setImmediate(() => { - this.id = void 0; + this.id = null; this.scheduler.scheduled = false; this.scheduler.flush(); }); @@ -30,8 +29,7 @@ export default class NextTickAction extends ImmediateAction { return this; } - unsubscribe() { - + unsubscribe(): void { const id = this.id; const scheduler = this.scheduler; @@ -40,10 +38,11 @@ export default class NextTickAction extends ImmediateAction { if (scheduler.actions.length === 0) { scheduler.active = false; scheduler.scheduled = false; - if (id) { - this.id = void 0; - Immediate.clearImmediate(id); - } + } + + if (id) { + this.id = null; + Immediate.clearImmediate(id); } } } \ No newline at end of file