From f2649376c5d958fa3041785cb25f2471241e5c61 Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Mon, 9 Mar 2015 19:19:47 -0400 Subject: [PATCH] passes flow checks --- lib/underscore.js | 6 ++++++ src/Root.js | 6 ++++-- src/TwoBitDataSource.js | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/underscore.js b/lib/underscore.js index e1e9e4a0..1007f04e 100644 --- a/lib/underscore.js +++ b/lib/underscore.js @@ -3,5 +3,11 @@ declare module "underscore" { declare function findWhere(list: Array, properties: {}): ?T; declare function clone(obj: T): T; + + declare function isEqual(a: S, b: T): boolean; + declare function range(a: number, b: number): Array; + declare function extend(...o: Object): Object; + + declare function chain(obj: S): any; } diff --git a/src/Root.js b/src/Root.js index 93b6e2bf..f7ea5be9 100644 --- a/src/Root.js +++ b/src/Root.js @@ -6,8 +6,10 @@ var React = require('react'), Controls = require('./Controls'), GenomeTrack = require('./GenomeTrack'), - types = require('./types'); // TODO: make this an "import type" when react-tools 0.13.0 is out. + TwoBitDataSource = require('./TwoBitDataSource'), + types = require('./types'); + var Root = React.createClass({ propTypes: { @@ -22,7 +24,7 @@ var Root = React.createClass({ }, componentDidMount: function() { // Note: flow is unable to infer this type through `this.propTypes`. - var source: TwoBitDataSource = this.props.referenceSource; + var source = this.props.referenceSource; source.needContigs(); source.on('contigs', () => { this.update() }) diff --git a/src/TwoBitDataSource.js b/src/TwoBitDataSource.js index b91ee069..231ada92 100644 --- a/src/TwoBitDataSource.js +++ b/src/TwoBitDataSource.js @@ -20,13 +20,17 @@ var Events = require('backbone').Events, _ = require('underscore'); +// TODO: make this an "import type" when react-tools 0.13.0 is out. +var TwoBit = require('./TwoBit'); + // Factor by which to over-request data from the network. // If a range of 100bp is shown and this is 2.0, then 300 base pairs will be // requested over the network (100 * 2.0 too much) var EXPANSION_FACTOR = 2.0; -var createTwoBitDataSource = function(remoteSource: TwoBit) { +// TODO: make the return type more precise +var createTwoBitDataSource = function(remoteSource: TwoBit): any { // Local cache of genomic data. var contigList = []; var basePairs = {}; // contig -> locus -> letter