From 33338d5b114aee07706fa4f9dcdeffec7c33ced5 Mon Sep 17 00:00:00 2001 From: michaelneu Date: Sat, 12 Nov 2016 22:57:47 +0100 Subject: [PATCH] Add definitions for voronoi-diagram --- voronoi-diagram/index.d.ts | 18 ++++++++++++++++++ voronoi-diagram/tsconfig.json | 19 +++++++++++++++++++ voronoi-diagram/voronoi-diagram-tests.ts | 14 ++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 voronoi-diagram/index.d.ts create mode 100644 voronoi-diagram/tsconfig.json create mode 100644 voronoi-diagram/voronoi-diagram-tests.ts diff --git a/voronoi-diagram/index.d.ts b/voronoi-diagram/index.d.ts new file mode 100644 index 0000000000..4f0811d3d3 --- /dev/null +++ b/voronoi-diagram/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for voronoi-diagram 1.0.1 +// Project: https://github.com/mikolalysenko/voronoi-diagram +// Definitions by: Michael Neu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module "voronoi-diagram" { + type Point = number[]; + type Cell = number[]; + type Position = number[]; + + interface VoronoiDiagram { + cells: Cell[]; + positions: Position[]; + } + + function voronoi(points: Point[]) : VoronoiDiagram; + export = voronoi; +} \ No newline at end of file diff --git a/voronoi-diagram/tsconfig.json b/voronoi-diagram/tsconfig.json new file mode 100644 index 0000000000..384e19c9b1 --- /dev/null +++ b/voronoi-diagram/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "voronoi-diagram-tests.ts" + ] +} \ No newline at end of file diff --git a/voronoi-diagram/voronoi-diagram-tests.ts b/voronoi-diagram/voronoi-diagram-tests.ts new file mode 100644 index 0000000000..3cd6bb667f --- /dev/null +++ b/voronoi-diagram/voronoi-diagram-tests.ts @@ -0,0 +1,14 @@ +/// + +import voronoi = require("voronoi-diagram"); + +let points = [ + [1, 1], + [2, 2], + [3, 3] +]; + +let diagram = voronoi(points); + +let firstCell = diagram.cells[0], + firstPosition = diagram.positions[0]; \ No newline at end of file