From 21b8fc2b4f7f340be9e63ea995bc44af594cff04 Mon Sep 17 00:00:00 2001 From: Erik Arvidsson Date: Thu, 22 Sep 2016 15:22:20 -0700 Subject: [PATCH] Update Flow to 0.32 (#2606) Motivation: Better libs needed in an upcoming PR. --- js/noms/package.json | 2 +- js/noms/src/fetch.js | 1 - js/noms/src/put-cache.js | 2 -- js/noms/src/struct-test.js | 2 +- js/perf/package.json | 2 +- samples/js/fb/find-photos/src/main.js | 7 ++----- samples/js/package.json | 2 +- 7 files changed, 6 insertions(+), 12 deletions(-) diff --git a/js/noms/package.json b/js/noms/package.json index a44e0c7bbc..392476a2e2 100644 --- a/js/noms/package.json +++ b/js/noms/package.json @@ -35,7 +35,7 @@ "chokidar": "^1.6.0", "commander": "^2.9.0", "documentation": "documentationjs/documentation#a71bb03681cd145723218910145c835dd5171a74", - "flow-bin": "0.30.0", + "flow-bin": "^0.32.0", "fs-extra": "^0.30.0", "mocha": "^2.5.3", "nyc": "^8.3.0" diff --git a/js/noms/src/fetch.js b/js/noms/src/fetch.js index 0a97546c23..d219f5b40f 100644 --- a/js/noms/src/fetch.js +++ b/js/noms/src/fetch.js @@ -83,7 +83,6 @@ function fetch(url: string, options: FetchOptions = {}): Promise { } function arrayBufferToBuffer(ab: ArrayBuffer): Buffer { - // $FlowIssue: Node type declaration doesn't include ArrayBuffer. return new Buffer(ab); } diff --git a/js/noms/src/put-cache.js b/js/noms/src/put-cache.js index a5c52e6960..382aa68137 100644 --- a/js/noms/src/put-cache.js +++ b/js/noms/src/put-cache.js @@ -183,7 +183,6 @@ class DbCollection { insert(item: ChunkItem, options: Object = {}): Promise { return new Promise((resolve, reject) => { options.w = 1; - //$FlowIssue const data = new Binary(new Buffer(item.data.buffer)); this._coll.insert({hash: item.hash, data: data}, options, (err, result) => { if (err) { @@ -236,7 +235,6 @@ function recordToItem(record: DbRecord): ChunkItem { function makeTempDir(): Promise { return new Promise((resolve, reject) => { - //$FlowIssue fs.mkdtemp('/tmp/put-cache-', (err, folder) => { if (err) { reject(err); diff --git a/js/noms/src/struct-test.js b/js/noms/src/struct-test.js index 46a8ca9914..d06db4ff9a 100644 --- a/js/noms/src/struct-test.js +++ b/js/noms/src/struct-test.js @@ -148,7 +148,7 @@ suite('Struct', () => { }); }); - function assertDiff(expect: [string], s1: Struct, s2: Struct) { + function assertDiff(expect: string[], s1: Struct, s2: Struct) { const actual = structDiff(s1, s2); assert.deepEqual(expect, actual); } diff --git a/js/perf/package.json b/js/perf/package.json index 2a3f5088b2..62a5a144c1 100644 --- a/js/perf/package.json +++ b/js/perf/package.json @@ -27,7 +27,7 @@ "classnames": "^2.1.3", "csv": "^1.1.0", "flickr-oauth-and-upload": "^0.8.0", - "flow-bin": "^0.30.0", + "flow-bin": "^0.32.0", "http-server": "^0.9.0", "humanize": "^0.0.9", "mocha": "^2.5.3", diff --git a/samples/js/fb/find-photos/src/main.js b/samples/js/fb/find-photos/src/main.js index 3938c95116..5f520b239d 100644 --- a/samples/js/fb/find-photos/src/main.js +++ b/samples/js/fb/find-photos/src/main.js @@ -7,7 +7,6 @@ import argv from 'yargs'; import { DatasetSpec, - invariant, isSubtype, makeListType, makeStructType, @@ -96,17 +95,15 @@ async function main(): Promise { return output.commit(await result).then(() => db.close()); } -function getGeo(input: Struct): Struct { - invariant(input.place); +function getGeo(input): Struct { return newStruct('Geoposition', { latitude: input.place.location.latitude, longitude: input.place.location.longitude, }); } -async function getSizes(input: Struct): Promise> { +async function getSizes(input): Promise> { let result = Promise.resolve(new Map()); - invariant(input.images); await input.images.forEach(v => { result = result.then(m => m.set( newStruct('', {width: v.width, height: v.height}), diff --git a/samples/js/package.json b/samples/js/package.json index 86d26825af..e4d4161a2d 100644 --- a/samples/js/package.json +++ b/samples/js/package.json @@ -27,7 +27,7 @@ "classnames": "^2.1.3", "csv": "^1.1.0", "flickr-oauth-and-upload": "^0.8.0", - "flow-bin": "^0.30.0", + "flow-bin": "^0.32.0", "http-server": "^0.9.0", "humanize": "^0.0.9", "mocha": "^2.5.3",