diff --git a/types/topojson-server/index.d.ts b/types/topojson-server/index.d.ts new file mode 100644 index 0000000000..62cfb49b60 --- /dev/null +++ b/types/topojson-server/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for topojson-server 3.0 +// Project: https://github.com/topojson/topojson-server +// Definitions by: Ricardo Mello +// Zhutian Chen +// denisname +// Russell Porter +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.5 + +import * as GeoJSON from "geojson"; +import * as TopoJSON from "topojson-specification"; + +export function topology(objects: {[k: string]: GeoJSON.GeoJsonObject}, quantization?: number): TopoJSON.Topology; diff --git a/types/topojson-server/topojson-server-tests.ts b/types/topojson-server/topojson-server-tests.ts new file mode 100644 index 0000000000..f02e823b2d --- /dev/null +++ b/types/topojson-server/topojson-server-tests.ts @@ -0,0 +1,19 @@ +// Tests for: https://github.com/topojson/topojson-server + +import * as topojson from "topojson-server"; + +let topo: TopoJSON.Topology; + +const aPoint: GeoJSON.Point = { type: "Point", coordinates: [30, 10] }; +const aPolygon: GeoJSON.Polygon = { + type: "Polygon", + coordinates: [[[30, 10], [40, 40], [20, 40], [30, 10]]] +}; + +const objects = { + aPoint, + aPolygon +}; + +topo = topojson.topology(objects); +topo = topojson.topology(objects, 1e4); diff --git a/types/topojson-server/tsconfig.json b/types/topojson-server/tsconfig.json new file mode 100644 index 0000000000..e324dec2ea --- /dev/null +++ b/types/topojson-server/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "topojson-server-tests.ts" + ] +} diff --git a/types/topojson-server/tslint.json b/types/topojson-server/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/topojson-server/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/topojson/index.d.ts b/types/topojson/index.d.ts index 75f1853f39..4dacf19f04 100644 --- a/types/topojson/index.d.ts +++ b/types/topojson/index.d.ts @@ -15,7 +15,7 @@ export as namespace topojson; // TopoJSON Server // --------------------------------------------------------------- -export function topology(objects: {[k: string]: GeoJSON.GeoJsonObject}, quantization?: number): TopoJSON.Topology; +export * from 'topojson-server'; // --------------------------------------------------------------- // TopoJSON Simplify diff --git a/types/topojson/test/server-tests.ts b/types/topojson/test/server-tests.ts deleted file mode 100644 index 9ee794593e..0000000000 --- a/types/topojson/test/server-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Tests for: https://github.com/topojson/topojson-server - -let topo: TopoJSON.Topology; - -const aPoint: GeoJSON.Point = {type: "Point", coordinates: [30, 10]}; -const aPolygon: GeoJSON.Polygon = {type: "Polygon", coordinates: [[[30, 10], [40, 40], [20, 40], [30, 10]]]}; - -const objects = { - aPoint, - aPolygon, -}; - -topo = topojson.topology(objects); -topo = topojson.topology(objects, 1e4); diff --git a/types/topojson/tsconfig.json b/types/topojson/tsconfig.json index 75f46ff807..8cca6fe7bf 100644 --- a/types/topojson/tsconfig.json +++ b/types/topojson/tsconfig.json @@ -20,7 +20,6 @@ "files": [ "index.d.ts", "topojson-tests.ts", - "test/atlas-tests.ts", - "test/server-tests.ts" + "test/atlas-tests.ts" ] } \ No newline at end of file