Thomas Hervey 14f354ffca
Typescript-ifying turf-great-circle (#2733)
* Added typing to index.ts, tests to test.ts

* Update pnpm-lock.yaml after dependency updates

* Replace embedded arc.js with external TypeScript arc package

- Add arc@^0.2.0 (WIP bump) as dependency to replace embedded lib/arc.js
- Update import from './lib/arc.js' to 'arc' package
- Fix TypeScript type compatibility issues:
  - Handle null properties with fallback to empty object
  - Add proper type assertion for return value
- All tests pass (9/9) with new TypeScript arc.js integration
- Maintains 100% backward compatibility while adding full TypeScript support

* Remove arc.d.ts which is no longer needed, regenerate pnpm-lock

---------

Co-authored-by: mfedderly <24275386+mfedderly@users.noreply.github.com>
2025-12-08 08:47:38 -05:00

16 lines
382 B
TypeScript

import Benchmark from "benchmark";
import { point } from "@turf/helpers";
import { greatCircle } from "./index.js";
const point1 = point([-75, 45]);
const point2 = point([30, 45]);
const suite = new Benchmark.Suite("turf-great-circle");
suite
.add("greatCircle", () => {
greatCircle(point1, point2);
})
.on("cycle", (e: any) => console.log(String(e.target)))
.run();