@samitouri / QOS-React-2 / commits / 7a7e792a6f

Make SchedulerMinHeap flow strict (#16351)

@acdlite while browsing Twitter, I saw [an opportunity][1] to do something more productive than browsing Twitter. [1]: https://twitter.com/acdlite/status/1160247965908234240 Test plan: `yarn flow-ci`, `yarn test-prod`, `yarn lint`

Desmond Brand committed Aug 10, 2019 at 13:44 UTC 7a7e792a6fd7668b37e475bf39e58fdb24e4ad81
1 file changed +5 -3
packages/scheduler/src/SchedulerMinHeap.js
+5 -3
@@ -4,7 +4,7 @@
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 - * @flow
7 + * @flow strict
8 */
9
10 type Heap = Array<Node>;
@@ -38,7 +38,8 @@ export function pop(heap: Heap): Node | null {
38 }
39 }
40
41 -function siftUp(heap, node, index) {
41 +function siftUp(heap, node, i) {
42 + let index = i;
43 while (true) {
44 const parentIndex = Math.floor((index - 1) / 2);
45 const parent = heap[parentIndex];
@@ -54,7 +55,8 @@ function siftUp(heap, node, index) {
55 }
56 }
57
57 -function siftDown(heap, node, index) {
58 +function siftDown(heap, node, i) {
59 + let index = i;
60 const length = heap.length;
61 while (index < length) {
62 const leftIndex = (index + 1) * 2 - 1;