Skip to content

Commit 98b9a4e

Browse files
authored
break(turf-projection) change toWgs84 and toMercator G = to G extends (#3157)
1 parent de0e092 commit 98b9a4e

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

packages/turf-projection/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,11 @@ import { clone } from "@turf/clone";
1818
* //addToMap
1919
* var addToMap = [pt, converted];
2020
*/
21-
function toMercator<G = AllGeoJSON | Position>(
21+
function toMercator<G extends AllGeoJSON | Position>(
2222
geojson: G,
2323
options: { mutate?: boolean } = {}
2424
): G {
25-
return project(
26-
geojson as GeoJSON | Position,
27-
convertToMercator,
28-
options
29-
) as G;
25+
return project(geojson, convertToMercator, options);
3026
}
3127

3228
/**
@@ -44,11 +40,11 @@ function toMercator<G = AllGeoJSON | Position>(
4440
* //addToMap
4541
* var addToMap = [pt, converted];
4642
*/
47-
function toWgs84<G = AllGeoJSON | Position>(
43+
function toWgs84<G extends AllGeoJSON | Position>(
4844
geojson: G,
4945
options: { mutate?: boolean } = {}
5046
): G {
51-
return project(geojson as GeoJSON | Position, convertToWgs84, options) as G;
47+
return project(geojson, convertToWgs84, options);
5248
}
5349

5450
/**

0 commit comments

Comments
 (0)