mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-07 18:50:14 +00:00
Add typing for topojson-server (#34145)
This commit is contained in:
13
types/topojson-server/index.d.ts
vendored
Normal file
13
types/topojson-server/index.d.ts
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
// Type definitions for topojson-server 3.0
|
||||
// Project: https://github.com/topojson/topojson-server
|
||||
// Definitions by: Ricardo Mello <https://github.com/ricardo-mello>
|
||||
// Zhutian Chen <https://github.com/chenzhutian>
|
||||
// denisname <https://github.com/denisname>
|
||||
// Russell Porter <https://github.com/russellporter>
|
||||
// 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;
|
||||
19
types/topojson-server/topojson-server-tests.ts
Normal file
19
types/topojson-server/topojson-server-tests.ts
Normal file
@@ -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);
|
||||
23
types/topojson-server/tsconfig.json
Normal file
23
types/topojson-server/tsconfig.json
Normal file
@@ -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"
|
||||
]
|
||||
}
|
||||
1
types/topojson-server/tslint.json
Normal file
1
types/topojson-server/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
2
types/topojson/index.d.ts
vendored
2
types/topojson/index.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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);
|
||||
@@ -20,7 +20,6 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"topojson-tests.ts",
|
||||
"test/atlas-tests.ts",
|
||||
"test/server-tests.ts"
|
||||
"test/atlas-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user