mirror of
https://github.com/Turfjs/turf.git
synced 2025-12-08 20:26:16 +00:00
* Simplify nx config (no point separately caching es and js builds - they both need to be done for any code changes). Fix some no-op type definitions i.e. X extends any, and enforce templated property types as having to extend GeoJsonProperties throughout. * Upgrade typescript. Had to update topojson-* type defs to avoid the P = GeoJsonProperties problem in geojson-rbush. Also fix a couple of floating point precision related issues that eslint now apparently catches! * Retire tslint. * Upgrade eslint and prettier. Add minimal prettier config (defaults have changed) to avoid widespread, minor formatting changes (trailing commas mostly).
24 lines
567 B
TypeScript
24 lines
567 B
TypeScript
import { BBox } from "geojson";
|
|
import hexGrid from "./index";
|
|
|
|
// prettier-ignore
|
|
const bbox: BBox = [
|
|
-96.6357421875,
|
|
31.12819929911196,
|
|
-84.9462890625,
|
|
40.58058466412764,
|
|
];
|
|
|
|
hexGrid(bbox, 50);
|
|
hexGrid(bbox, 50, { units: "miles" });
|
|
hexGrid(bbox, 50, { units: "miles", triangles: true });
|
|
|
|
// Access Custom Properties
|
|
const foo = hexGrid(bbox, 50, {
|
|
units: "miles",
|
|
triangles: true,
|
|
properties: { foo: "bar" },
|
|
});
|
|
foo.features[0].properties.foo;
|
|
// foo.features[0].properties.bar // => [ts] Property 'bar' does not exist on type '{ foo: string; }'.
|