Modified typedefs dependent on "geojson" to accommodate changes.

This commit is contained in:
Jeff Jacobson
2017-11-16 15:40:04 -08:00
parent 89667eb5cb
commit 335d12a4ee
11 changed files with 37 additions and 35 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ const sampleExtendedGeometryCollection: d3Geo.ExtendedGeometryCollection<GeoJSON
]
};
const sampleFeature: GeoJSON.Feature<GeoJSON.Polygon> = {
const sampleFeature: GeoJSON.Feature = {
type: 'Feature',
geometry: samplePolygon,
properties: {
@@ -74,7 +74,7 @@ const sampleExtendedFeature2: d3Geo.ExtendedFeature<d3Geo.GeoSphere, SamplePrope
}
};
const sampleFeatureCollection: GeoJSON.FeatureCollection<GeoJSON.Polygon> = {
const sampleFeatureCollection: GeoJSON.FeatureCollection = {
type: 'FeatureCollection',
features: [
sampleFeature,
+3 -1
View File
@@ -36,7 +36,9 @@ export type GeoGeometryObjects = GeoJSON.GeometryObject | GeoSphere;
export interface ExtendedGeometryCollection<GeometryType extends GeoGeometryObjects> {
type: string;
bbox?: number[];
crs?: GeoJSON.CoordinateReferenceSystem;
// GeoJSON removed the Coordinate System objects from the spec, but does allow
// "foreign members".
crs?: GeoJSON.GeoJsonObject;
geometries: GeometryType[];
}
+1 -1
View File
@@ -1,6 +1,6 @@
import { geojson2osm } from 'geojson2osm'
const features: GeoJSON.FeatureCollection<any> = {
const features: GeoJSON.FeatureCollection = {
type: 'FeatureCollection',
features: [{
type: 'Feature',
+1 -1
View File
@@ -11,4 +11,4 @@
* @param features Input features
* @returns OpenStreetMap XML
*/
export function geojson2osm(features: GeoJSON.Feature<any> | GeoJSON.FeatureCollection<any>): any
export function geojson2osm(features: GeoJSON.Feature | GeoJSON.FeatureCollection): any
+14 -14
View File
@@ -583,7 +583,7 @@ export interface PolylineOptions extends PathOptions {
export class Polyline<T extends geojson.GeometryObject = geojson.LineString | geojson.MultiLineString, P = any> extends Path {
constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
toGeoJSON(): geojson.Feature<T, P>;
toGeoJSON(): geojson.Feature;
getLatLngs(): LatLng[];
setLatLngs(latlngs: LatLngExpression[]): this;
isEmpty(): boolean;
@@ -591,7 +591,7 @@ export class Polyline<T extends geojson.GeometryObject = geojson.LineString | ge
getBounds(): LatLngBounds;
addLatLng(latlng: LatLngExpression | LatLngExpression[]): this;
feature?: geojson.Feature<T, P>;
feature?: geojson.Feature;
options: PolylineOptions;
}
@@ -616,14 +616,14 @@ export interface CircleMarkerOptions extends PathOptions {
export class CircleMarker<P = any> extends Path {
constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
toGeoJSON(): geojson.Feature<geojson.Point, P>;
toGeoJSON(): geojson.Feature;
setLatLng(latLng: LatLngExpression): this;
getLatLng(): LatLng;
setRadius(radius: number): this;
getRadius(): number;
options: CircleMarkerOptions;
feature?: geojson.Feature<geojson.Point, P>;
feature?: geojson.Feature;
}
export function circleMarker(latlng: LatLngExpression, options?: CircleMarkerOptions): CircleMarker;
@@ -671,7 +671,7 @@ export class LayerGroup<P = any> extends Layer {
/**
* Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint).
*/
toGeoJSON(): geojson.FeatureCollection<geojson.GeometryObject, P> | geojson.Feature<geojson.MultiPoint, P> | geojson.GeometryCollection;
toGeoJSON(): geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection;
/**
* Adds the given layer to the group.
@@ -725,7 +725,7 @@ export class LayerGroup<P = any> extends Layer {
*/
getLayerId(layer: Layer): number;
feature?: geojson.FeatureCollection<geojson.GeometryObject, P> | geojson.Feature<geojson.MultiPoint, P> | geojson.GeometryCollection;
feature?: geojson.FeatureCollection | geojson.Feature | geojson.GeometryCollection;
}
/**
@@ -765,7 +765,7 @@ export class FeatureGroup<P = any> extends LayerGroup<P> {
*/
export function featureGroup(layers?: Layer[]): FeatureGroup;
export type StyleFunction<P = any> = (feature?: geojson.Feature<geojson.GeometryObject, P>) => PathOptions;
export type StyleFunction<P = any> = (feature?: geojson.Feature) => PathOptions;
export interface GeoJSONOptions<P = any> extends LayerOptions {
/**
@@ -781,7 +781,7 @@ export interface GeoJSONOptions<P = any> extends LayerOptions {
* }
* ```
*/
pointToLayer?(geoJsonPoint: geojson.Feature<geojson.Point, P>, latlng: LatLng): Layer; // should import GeoJSON typings
pointToLayer?(geoJsonPoint: geojson.Feature, latlng: LatLng): Layer; // should import GeoJSON typings
/**
* A Function defining the Path options for styling GeoJSON lines and polygons,
@@ -807,7 +807,7 @@ export interface GeoJSONOptions<P = any> extends LayerOptions {
* function (feature, layer) {}
* ```
*/
onEachFeature?(feature: geojson.Feature<geojson.GeometryObject, P>, layer: Layer): void;
onEachFeature?(feature: geojson.Feature, layer: Layer): void;
/**
* A Function that will be used to decide whether to show a feature or not.
@@ -820,7 +820,7 @@ export interface GeoJSONOptions<P = any> extends LayerOptions {
* }
* ```
*/
filter?(geoJsonFeature: geojson.Feature<geojson.GeometryObject, P>): boolean;
filter?(geoJsonFeature: geojson.Feature): boolean;
/**
* A Function that will be used for converting GeoJSON coordinates to LatLngs.
@@ -838,7 +838,7 @@ export class GeoJSON<P = any> extends FeatureGroup<P> {
* Creates a Layer from a given GeoJSON feature. Can use a custom pointToLayer
* and/or coordsToLatLng functions if provided as options.
*/
static geometryToLayer<P = any>(featureData: geojson.Feature<geojson.GeometryObject, P>, options?: GeoJSONOptions<P>): Layer;
static geometryToLayer(featureData: geojson.Feature, options?: GeoJSONOptions): Layer;
/**
* Creates a LatLng object from an array of 2 numbers (longitude, latitude) or
@@ -872,7 +872,7 @@ export class GeoJSON<P = any> extends FeatureGroup<P> {
/**
* Normalize GeoJSON geometries/features into GeoJSON features.
*/
static asFeature<P = any>(geojson: geojson.Feature<geojson.GeometryObject, P> | geojson.GeometryObject): geojson.Feature<geojson.GeometryObject, P>;
static asFeature(geojson: geojson.Feature | geojson.GeometryObject): geojson.Feature;
constructor(geojson?: geojson.GeoJsonObject, options?: GeoJSONOptions<P>)
/**
@@ -1454,7 +1454,7 @@ export interface MarkerOptions extends InteractiveLayerOptions {
export class Marker<P = any> extends Layer {
constructor(latlng: LatLngExpression, options?: MarkerOptions);
toGeoJSON(): geojson.Feature<geojson.Point, P>;
toGeoJSON(): geojson.Feature;
getLatLng(): LatLng;
setLatLng(latlng: LatLngExpression): this;
setZIndexOffset(offset: number): this;
@@ -1465,7 +1465,7 @@ export class Marker<P = any> extends Layer {
// Properties
options: MarkerOptions;
dragging?: Handler;
feature?: geojson.Feature<geojson.Point, P>;
feature?: geojson.Feature;
}
export function marker(latlng: LatLngExpression, options?: MarkerOptions): Marker;
+6 -6
View File
@@ -223,7 +223,7 @@ declare namespace L {
/**
* Returns a GeoJSON representation of the circle (GeoJSON Point Feature).
*/
toGeoJSON(): GeoJSON.Feature<GeoJSON.Point>;
toGeoJSON(): GeoJSON.Feature;
}
}
@@ -1716,7 +1716,7 @@ declare namespace L {
* Returns a GeoJSON representation of the layer group (GeoJSON FeatureCollection).
* Note: Descendent classes MultiPolygon & MultiPolyLine return `Feature`s, not `FeatureCollection`s
*/
toGeoJSON(): GeoJSON.FeatureCollection<GeoJSON.GeometryObject>|GeoJSON.Feature<GeoJSON.MultiLineString|GeoJSON.MultiPolygon>;
toGeoJSON(): GeoJSON.FeatureCollection|GeoJSON.Feature;
////////////
////////////
@@ -2943,7 +2943,7 @@ declare namespace L {
/**
* Returns a GeoJSON representation of the marker (GeoJSON Point Feature).
*/
toGeoJSON(): GeoJSON.Feature<GeoJSON.Point>;
toGeoJSON(): GeoJSON.Feature;
/**
* Marker dragging handler (by both mouse and touch).
@@ -3103,7 +3103,7 @@ declare namespace L {
/**
* Returns a GeoJSON representation of the multipolygon (GeoJSON MultiPolygon Feature).
*/
toGeoJSON(): GeoJSON.Feature<GeoJSON.MultiPolygon>;
toGeoJSON(): GeoJSON.Feature;
}
}
@@ -3144,7 +3144,7 @@ declare namespace L {
/**
* Returns a GeoJSON representation of the multipolyline (GeoJSON MultiLineString Feature).
*/
toGeoJSON(): GeoJSON.Feature<GeoJSON.MultiLineString>;
toGeoJSON(): GeoJSON.Feature;
}
}
@@ -3565,7 +3565,7 @@ declare namespace L {
/**
* Returns a GeoJSON representation of the polyline (GeoJSON LineString Feature).
*/
toGeoJSON(): GeoJSON.Feature<GeoJSON.LineString>;
toGeoJSON(): GeoJSON.Feature;
}
}
+4 -4
View File
@@ -54,9 +54,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[];
querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature<GeoJSON.GeometryObject>[];
querySourceFeatures(sourceID: string, parameters?: {sourceLayer?: string, filter?: any[]}): GeoJSON.Feature[];
setStyle(style: mapboxgl.Style | string): this;
@@ -507,11 +507,11 @@ declare namespace mapboxgl {
constructor(options?: mapboxgl.GeoJSONSourceOptions);
setData(data: GeoJSON.Feature<GeoJSON.GeometryObject> | GeoJSON.FeatureCollection<GeoJSON.GeometryObject> | String): this;
setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this;
}
export interface GeoJSONSourceOptions {
data?: GeoJSON.Feature<GeoJSON.GeometryObject> | GeoJSON.FeatureCollection<GeoJSON.GeometryObject> | string;
data?: GeoJSON.Feature | GeoJSON.FeatureCollection | string;
maxzoom?: number;
+1 -1
View File
@@ -9,7 +9,7 @@
interface Polyline {
decode(string: string, precision?: number): number[][];
encode(coordinate: number[][], precision?: number): string;
fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature<GeoJSON.LineString>, precision?: number): string;
fromGeoJSON(geojson: GeoJSON.LineString | GeoJSON.Feature, precision?: number): string;
}
declare var polyline: Polyline;
+2 -2
View File
@@ -15,7 +15,7 @@ declare namespace shapefile {
}
interface Feature {
done: boolean
value: GeoJSON.Feature<any>
value: GeoJSON.Feature
}
interface Shapefile {
bbox: Array<number>
@@ -23,7 +23,7 @@ declare namespace shapefile {
}
interface ShapefileStatic {
open(shp: any, dbf?: any, options?: Options): Promise<Shapefile>;
read(shp: any, dbf?: any, options?: Options): Promise<GeoJSON.FeatureCollection<any>>;
read(shp: any, dbf?: any, options?: Options): Promise<GeoJSON.FeatureCollection>;
}
}
+1 -1
View File
@@ -94,7 +94,7 @@ export class Supercluster {
*/
export default function supercluster(options: Options): Supercluster;
export type Point = GeoJSON.Feature<GeoJSON.Point>;
export type Point = GeoJSON.Feature;
export type Points = Point[];
export type Clusters = Cluster[];
export type TileFeatures = TileFeature[];
+2 -2
View File
@@ -14,12 +14,12 @@ declare namespace tilebelt {
*
* @name tileToGeoJSON
* @param {Array<number>} tile
* @returns {Feature<Polygon>}
* @returns {Feature}
* @example
* var poly = tileToGeoJSON([5, 10, 10])
* //=poly
*/
tileToGeoJSON(tile: Array<number>): GeoJSON.Feature<GeoJSON.Polygon>
tileToGeoJSON(tile: Array<number>): GeoJSON.Feature
/**
* Get the bbox of a tile