diff --git a/packages/metro-bundler/src/node-haste/lib/AsyncTaskGroup.js b/packages/metro-bundler/src/node-haste/lib/AsyncTaskGroup.js index 7f99b25e..81235595 100644 --- a/packages/metro-bundler/src/node-haste/lib/AsyncTaskGroup.js +++ b/packages/metro-bundler/src/node-haste/lib/AsyncTaskGroup.js @@ -5,23 +5,31 @@ * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow */ + 'use strict'; -module.exports = class AsyncTaskGroup { +module.exports = class AsyncTaskGroup { + _runningTasks: Set; + _resolve: ?() => void; + done: Promise; + constructor() { this._runningTasks = new Set(); this._resolve = null; this.done = new Promise(resolve => this._resolve = resolve); } - start(taskHandle) { + start(taskHandle: TTaskHandle) { this._runningTasks.add(taskHandle); } - end(taskHandle) { + end(taskHandle: TTaskHandle) { const runningTasks = this._runningTasks; if (runningTasks.delete(taskHandle) && runningTasks.size === 0) { + /* $FlowFixMe: could be null */ this._resolve(); } }