Mapbox-gl and Geojson types update (#22544)

* Update mapbox-gl and geojson types

* Make geojson coordinates optional

* Increase mapbox type header

* Remove changes of GeometryObject and use internal mapbox any geometry type
This commit is contained in:
Alexandre 2018-01-12 18:34:37 +00:00 committed by Ryan Cavanaugh
parent db2f29e765
commit 4e9fc99430

View File

@ -1,4 +1,4 @@
// Type definitions for Mapbox GL JS v0.42.2
// Type definitions for Mapbox GL JS v0.43.0
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>, Patrick Reames <https://github.com/patrickr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -57,9 +57,9 @@ declare namespace mapboxgl {
unproject(point: PointLike): mapboxgl.LngLat;
queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: { layers?: string[], filter?: any[] }): GeoJSON.Feature<GeoJSON.GeometryObject>[];
queryRenderedFeatures(pointOrBox?: PointLike | PointLike[], parameters?: { layers?: string[], filter?: any[] }): GeoJSON.Feature<GeoJSONGeometry>[];
querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): GeoJSON.Feature<GeoJSON.GeometryObject>[];
querySourceFeatures(sourceID: string, parameters?: { sourceLayer?: string, filter?: any[] }): GeoJSON.Feature<GeoJSONGeometry>[];
setStyle(style: mapboxgl.Style | string): this;
@ -79,6 +79,8 @@ declare namespace mapboxgl {
addImage(name: string, image: HTMLImageElement | ArrayBufferView, options?: { width?: number, height?: number, pixelRatio?: number }): this;
hasImage(name: string): boolean;
removeImage(name: string): this;
loadImage(url: string, callback: Function): this;
@ -93,7 +95,7 @@ declare namespace mapboxgl {
setFilter(layer: string, filter?: any[]): this;
setLayerZoomRange(layerId: string, minzoom: number, maxzoom: number): this;
setLayerZoomRange(layerId: string, minzoom?: number, maxzoom?: number): this;
getFilter(layer: string): any[];
@ -499,6 +501,8 @@ declare namespace mapboxgl {
type: 'vector' | 'raster' | 'geojson' | 'image' | 'video' | 'canvas';
}
export type GeoJSONGeometry = GeoJSON.Point | GeoJSON.LineString | GeoJSON.MultiPoint | GeoJSON.Polygon | GeoJSON.MultiLineString | GeoJSON.MultiPolygon | GeoJSON.GeometryCollection;
/**
* GeoJSONSource
*/
@ -512,11 +516,11 @@ declare namespace mapboxgl {
constructor(options?: mapboxgl.GeoJSONSourceOptions);
setData(data: GeoJSON.Feature<GeoJSON.GeometryObject> | GeoJSON.FeatureCollection<GeoJSON.GeometryObject> | String): this;
setData(data: GeoJSON.Feature<GeoJSONGeometry> | GeoJSON.FeatureCollection<GeoJSONGeometry> | String): this;
}
export interface GeoJSONSourceOptions {
data?: GeoJSON.Feature<GeoJSON.GeometryObject> | GeoJSON.FeatureCollection<GeoJSON.GeometryObject> | string;
data?: GeoJSON.Feature<GeoJSONGeometry> | GeoJSON.FeatureCollection<GeoJSONGeometry> | string;
maxzoom?: number;
@ -753,6 +757,10 @@ declare namespace mapboxgl {
getPopup(): Popup;
getOffset(): PointLike;
setOffset(offset: PointLike): this;
togglePopup(): this;
}