Skip to content

Commit 2b48d38

Browse files
committed
Update bench and test, remove turf-jsts typings in favor of upstreaming
1 parent 7af323a commit 2b48d38

3 files changed

Lines changed: 9 additions & 34 deletions

File tree

packages/turf-buffer/bench.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ const fixtures = fs.readdirSync(directory).map((filename) => {
4646
const suite = new Benchmark.Suite("turf-buffer");
4747
for (const { name, geojson } of fixtures) {
4848
console.time(name);
49-
buffer(geojson, 50, { units: "miles" });
49+
buffer(geojson as any, 50, { units: "miles" });
5050
console.timeEnd(name);
51-
suite.add(name, () => buffer(geojson, 50, { units: "miles" }));
51+
suite.add(name, () => buffer(geojson as any, 50, { units: "miles" }));
5252
}
5353

54-
suite.on("cycle", (e) => console.log(String(e.target))).run();
54+
suite.on("cycle", (e: any) => console.log(String(e.target))).run();

packages/turf-buffer/test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
geometryCollection,
1414
} from "@turf/helpers";
1515
import { buffer } from "./index.js";
16+
import { Feature, Point, Polygon } from "geojson";
1617

1718
const __dirname = path.dirname(fileURLToPath(import.meta.url));
1819

@@ -34,14 +35,14 @@ test("turf-buffer", (t) => {
3435
fixtures.forEach((fixture) => {
3536
const filename = fixture.filename;
3637
const name = fixture.name;
37-
const geojson = fixture.geojson;
38-
const properties = geojson.properties || {};
38+
const geojson = fixture.geojson as any;
39+
const properties = (geojson as Feature).properties || {};
3940
const radius = properties.radius || 50;
4041
const units = properties.units || "miles";
4142
const steps = properties.steps;
4243

4344
const buffered = truncate(
44-
buffer(geojson, radius, { units: units, steps: steps })
45+
buffer(geojson, radius, { units: units, steps: steps })!
4546
);
4647

4748
// Add Results to FeatureCollection
@@ -112,7 +113,7 @@ test("turf-buffer - Prevent Input Mutation", (t) => {
112113
[11, 0],
113114
],
114115
]);
115-
const collection = featureCollection([pt, poly]);
116+
const collection = featureCollection<Point | Polygon>([pt, poly]);
116117

117118
const beforePt = JSON.parse(JSON.stringify(pt));
118119
const beforePoly = JSON.parse(JSON.stringify(poly));
@@ -182,7 +183,7 @@ test("turf-buffer - undefined return", (t) => {
182183
t.end();
183184
});
184185

185-
function colorize(feature, color) {
186+
function colorize(feature: Feature, color: string) {
186187
color = color || "#F00";
187188
if (feature.properties) {
188189
feature.properties.stroke = color;

packages/turf-buffer/turf-jsts.d.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)