Add definitions for voronoi-diagram

This commit is contained in:
michaelneu 2016-11-12 22:57:47 +01:00
parent 48c95a4bb4
commit 33338d5b11
3 changed files with 51 additions and 0 deletions

18
voronoi-diagram/index.d.ts vendored Normal file
View File

@ -0,0 +1,18 @@
// Type definitions for voronoi-diagram 1.0.1
// Project: https://github.com/mikolalysenko/voronoi-diagram
// Definitions by: Michael Neu <https://github.com/michaelneu>
// 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;
}

View File

@ -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"
]
}

View File

@ -0,0 +1,14 @@
/// <reference path="index.d.ts" />
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];