Skip to content

Move local type definitions out of flow-typed - #7031

Merged
anandthakker merged 5 commits into
masterfrom
localize-flow-types
Jul 31, 2018
Merged

anandthakker merged 5 commits into
masterfrom
localize-flow-types

Conversation

@anandthakker

Copy link
Copy Markdown
Contributor

Prepares for #6963

@anandthakker
anandthakker requested a review from jfirebaugh July 26, 2018 16:00
@anandthakker

anandthakker commented Jul 26, 2018 •

Copy link
Copy Markdown
Contributor Author

Note also that I replaced our GeoJSON declarations with https://github.com/bigslycat/flow-geojson, which seems like a pretty well-written set of Flow types for GeoJSON -- this was primarily motivated by wanting vector-tile module and gl-js to reference a common set of type definitions.

@jfirebaugh

jfirebaugh commented Jul 26, 2018 •

Copy link
Copy Markdown
Contributor

Eh, I'm not a fan of those GeoJSON definitions. They're much more complicated than is necessary, and there are at least a couple of issues (feature geometry should be nullable, JSONArray type is wrong).

Edit: also properties should not be nullable.

@anandthakker

Copy link
Copy Markdown
Contributor Author

Dang, I missed those. Alright, alternative: we could keep the ones we had and publish them as a separate npm pacakge @mapbox/geojson-types

@anandthakker

Copy link
Copy Markdown
Contributor Author

Edit: also properties should not be nullable

@jfirebaugh looks like the spec allows null for properties:

 A Feature object has a member with the name "properties".  The
 value of the properties member is an object (any JSON object or a
 JSON null value).

https://tools.ietf.org/html/rfc7946#section-3.2

Anand Thakker added 3 commits July 30, 2018 15:48
Remaining declarations in flow-typed/ are exclusively for external
dependencies
@anandthakker
anandthakker force-pushed the localize-flow-types branch from 519c780 to 33b3d62 Compare July 30, 2018 19:49
@anandthakker

Copy link
Copy Markdown
Contributor Author

@jfirebaugh updated

Comment thread flow-typed/vector-tile.js Outdated
@@ -1,4 +1,6 @@
import type Pbf from 'pbf';
import type Point from '@mapbox/point-geometry';
import type { Feature } from 'flow-geojson';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to @mapbox/geojson-types.

Comment thread package.json Outdated
"execcommand-copy": "^1.1.0",
"flow-bin": "^0.69.0",
"flow-coverage-report": "^0.3.0",
"flow-geojson": "^2.0.6",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove.

Comment thread src/source/geojson_source.js Outdated
import type {Callback} from '../types/callback';
import type {PerformanceResourceTiming} from '../types/performance_resource_timing';
import type {GeoJSON, GeoJSONFeature} from '@mapbox/geojson-types';
import type {GeojsonSourceSpecification} from '../style-spec/types';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's special-case the generator so "GeoJSON" is capitalized consistently. (Looks like it already has a special-case for "DEM".)

@anandthakker
anandthakker merged commit 5b9986d into master Jul 31, 2018
@anandthakker
anandthakker deleted the localize-flow-types branch July 31, 2018 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants