From 0fbab808e078fdce36a37cf40c150a6f43302a8f Mon Sep 17 00:00:00 2001 From: michaelneu Date: Wed, 16 Nov 2016 00:09:42 +0100 Subject: [PATCH] use external module style in voronoi-diagram --- voronoi-diagram/index.d.ts | 12 ++++----- voronoi-diagram/tsconfig.json | 34 ++++++++++++------------ voronoi-diagram/voronoi-diagram-tests.ts | 5 +++- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/voronoi-diagram/index.d.ts b/voronoi-diagram/index.d.ts index 4f0811d3d3..2926777823 100644 --- a/voronoi-diagram/index.d.ts +++ b/voronoi-diagram/index.d.ts @@ -3,16 +3,16 @@ // Definitions by: Michael Neu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare module "voronoi-diagram" { +declare namespace voronoi { type Point = number[]; type Cell = number[]; - type Position = number[]; interface VoronoiDiagram { cells: Cell[]; - positions: Position[]; + positions: Point[]; } +} - function voronoi(points: Point[]) : VoronoiDiagram; - export = voronoi; -} \ No newline at end of file +declare function voronoi(points: voronoi.Point[]) : voronoi.VoronoiDiagram; + +export = voronoi; \ No newline at end of file diff --git a/voronoi-diagram/tsconfig.json b/voronoi-diagram/tsconfig.json index 384e19c9b1..1347450427 100644 --- a/voronoi-diagram/tsconfig.json +++ b/voronoi-diagram/tsconfig.json @@ -1,19 +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" - ] + "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 index 3cd6bb667f..31b261e1ce 100644 --- a/voronoi-diagram/voronoi-diagram-tests.ts +++ b/voronoi-diagram/voronoi-diagram-tests.ts @@ -2,7 +2,10 @@ import voronoi = require("voronoi-diagram"); -let points = [ +const x: voronoi.Point = [1, 2]; + +let points: voronoi.Point[] = [ + x, [1, 1], [2, 2], [3, 3]