Skip to content

Commit 8a1ed5d

Browse files
authored
Merge pull request #3009 from Turfjs/mf/fix-lineoffset-types
Fixed @turf/line-offset's return type regression
1 parent 5721ddd commit 8a1ed5d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/turf-line-offset/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function lineOffset<T extends LineString | MultiLineString>(
3232
geojson: Feature<T> | T,
3333
distance: number,
3434
options: { units?: Units } = {}
35-
) {
35+
): Feature<T> {
3636
// Optional parameters
3737
options = options || {};
3838
if (!isObject(options)) throw new Error("options is invalid");
@@ -48,15 +48,15 @@ function lineOffset<T extends LineString | MultiLineString>(
4848

4949
switch (type) {
5050
case "LineString":
51-
return lineOffsetFeature(geojson, distance, units);
51+
return lineOffsetFeature(geojson, distance, units) as Feature<T>;
5252
case "MultiLineString":
5353
var coords: Position[][] = [];
5454
flattenEach(geojson, function (feature) {
5555
coords.push(
5656
lineOffsetFeature(feature, distance, units).geometry.coordinates
5757
);
5858
});
59-
return multiLineString(coords, properties);
59+
return multiLineString(coords, properties) as Feature<T>;
6060
default:
6161
throw new Error("geometry " + type + " is not supported");
6262
}

0 commit comments

Comments
 (0)