Skip to content

Commit

Permalink
Upgrade flow to 0.66 (#6288)
Browse files Browse the repository at this point in the history
  • Loading branch information
anandthakker authored Mar 7, 2018
1 parent 4b1195a commit 31d92db
Show file tree
Hide file tree
Showing 13 changed files with 24 additions and 20 deletions.
3 changes: 2 additions & 1 deletion .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
.*/node_modules/conventional-changelog-core/.*
.*/node_modules/htmltojsx/.*
.*/node_modules/documentation/.*
.*/node_modules/module-deps/.*
.*/test/unit/style-spec/fixture/invalidjson.input.json
.*/test/integration/render-tests/.*

[version]
0.62.0
0.66.0
3 changes: 2 additions & 1 deletion flow-typed/mapbox-gl-js-test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
declare module "mapbox-gl-js-test" {
declare type CreateTest = (name: string, body: (test: CreateTest) => void) => void;
declare var exports: CreateTest;
declare module.exports: CreateTest;
}
2 changes: 1 addition & 1 deletion flow-typed/mapbox-gl-supported.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
'use strict';
declare module "@mapbox/mapbox-gl-supported" {
declare type isSupported = (options?: {failIfMajorPerformanceCaveat: boolean}) => boolean;
declare var exports: isSupported;
declare module.exports: isSupported;
}
2 changes: 1 addition & 1 deletion flow-typed/unitbezier.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ declare module "unitbezier" {
solveCurveX(t: number): number;
solve(x: number, epsilon?: number): number;
}
declare var exports: typeof UnitBezier;
declare module.exports: typeof UnitBezier;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"eslint-plugin-node": "^5.1.1",
"eslint-plugin-react": "^7.3.0",
"execcommand-copy": "^1.1.0",
"flow-bin": "^0.62.0",
"flow-bin": "^0.66.0",
"flow-coverage-report": "^0.3.0",
"flow-remove-types": "^1.0.4",
"github-slugger": "^1.1.1",
Expand Down
4 changes: 2 additions & 2 deletions src/source/source_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class SourceCache extends Evented {
_sourceErrored: boolean;
_tiles: {[any]: Tile};
_cache: Cache<Tile>;
_timers: {[any]: number};
_cacheTimers: {[any]: number};
_timers: {[any]: TimeoutID};
_cacheTimers: {[any]: TimeoutID};
_maxTileCacheSize: ?number;
_paused: boolean;
_shouldReloadOnResume: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Camera extends Evented {
_pitching: boolean;

_bearingSnap: number;
_onEaseEnd: number;
_onEaseEnd: TimeoutID;
_easeStart: number;
_isEasing: boolean;
_easeOptions: {duration: number, easing: (number) => number};
Expand Down
2 changes: 1 addition & 1 deletion src/ui/control/geolocate_control.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class GeolocateControl extends Evented {
_dotElement: HTMLElement;
_geolocateButton: HTMLElement;
_geolocationWatchID: number;
_timeoutId: ?number;
_timeoutId: ?TimeoutID;
_watchState: string;
_lastKnownPosition: any;
_userLocationDotMarker: Marker;
Expand Down
2 changes: 1 addition & 1 deletion src/ui/handler/dblclick_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DoubleClickZoomHandler {
_map: Map;
_enabled: boolean;
_active: boolean;
_tapped: ?number;
_tapped: ?TimeoutID;

/**
* @private
Expand Down
8 changes: 5 additions & 3 deletions src/ui/handler/scroll_zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ class ScrollZoomHandler {
_aroundPoint: Point;
_type: 'wheel' | 'trackpad' | null;
_lastValue: number;
_timeout: ?number; // used for delayed-handling of a single wheel movement
_finishTimeout: ?number; // used to delay final '{move,zoom}end' events
_timeout: ?TimeoutID; // used for delayed-handling of a single wheel movement
_finishTimeout: ?TimeoutID; // used to delay final '{move,zoom}end' events

_lastWheelEvent: any;
_lastWheelEventTime: number;
Expand Down Expand Up @@ -175,7 +175,9 @@ class ScrollZoomHandler {
this._active = true;
this._map.fire(new Event('movestart', {originalEvent: e}));
this._map.fire(new Event('zoomstart', {originalEvent: e}));
clearTimeout(this._finishTimeout);
if (this._finishTimeout) {
clearTimeout(this._finishTimeout);
}

const pos = DOM.mousePos(this._el, e);

Expand Down
2 changes: 1 addition & 1 deletion src/ui/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import type Map from './map';
*/
class Hash {
_map: Map;
_updateHash: () => number;
_updateHash: () => TimeoutID;

constructor() {
util.bindAll([
Expand Down
6 changes: 3 additions & 3 deletions src/util/throttle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
Throttle the given function to run at most every period milliseconds.
* @private
*/
module.exports = function throttle(fn: () => void, time: number): () => number {
module.exports = function throttle(fn: () => void, time: number): () => TimeoutID {
let pending = false;
let timerId = 0;
let timerId: TimeoutID = (0: any);

const later = () => {
timerId = 0;
timerId = (0: any);
if (pending) {
fn();
timerId = setTimeout(later, time);
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4237,9 +4237,9 @@ flatten@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782"

flow-bin@^0.62.0:
version "0.62.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.62.0.tgz#14bca669a6e3f95c0bc0c2d1eb55ec4e98cb1d83"
flow-bin@^0.66.0:
version "0.66.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.66.0.tgz#a96dde7015dc3343fd552a7b4963c02be705ca26"

flow-coverage-report@^0.3.0:
version "0.3.0"
Expand Down

0 comments on commit 31d92db

Please sign in to comment.