From e443441d3b6f99ad9a2f503f6b7c25ef3bfd8bf0 Mon Sep 17 00:00:00 2001 From: Ricardo Mello Date: Tue, 11 Apr 2017 02:10:47 -0300 Subject: [PATCH] Added type definitions for topojson 3.0 --- types/topojson/index.d.ts | 48 ++++++++++++++++++++++++++++++++ types/topojson/topojson-tests.ts | 6 ++++ types/topojson/tsconfig.json | 23 +++++++++++++++ types/topojson/tslint.json | 3 ++ 4 files changed, 80 insertions(+) create mode 100644 types/topojson/index.d.ts create mode 100644 types/topojson/topojson-tests.ts create mode 100644 types/topojson/tsconfig.json create mode 100644 types/topojson/tslint.json diff --git a/types/topojson/index.d.ts b/types/topojson/index.d.ts new file mode 100644 index 0000000000..6e4f473b34 --- /dev/null +++ b/types/topojson/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for topojson 3.0.0 +// Project: https://github.com/topojson/topojson +// Definitions by: Ricardo Mello +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function bbox(topology: any): any; + +export function feature(topology: any, o: any): { features: any[]; }; + +export function filter(topology: any, filter: any): any; + +export function filterAttached(topology: any): any; + +export function filterAttachedWeight(topology: any, minWeight: any, weight: any): any; + +export function filterWeight(topology: any, minWeight: any, weight: any): any; + +export function merge(topology: any, ...args: any[]): { type: any, coordinates: any[] }; + +export function mergeArcs(topology: any, objects: any): any; + +export function mesh(topology: any, ...args: any[]): { type: any; coordinates: any[]; }; + +export function meshArcs(topology: any, object$$1: any, filter: any, ...args: any[]): { type: any; coordinates: any[]; }; + +export function neighbors(objects: any): any[]; + +export function planarRingArea(ring: any): any; + +export function planarTriangleArea(triangle: any): any; + +export function presimplify(topology: any, weight: any): any[]; + +export function quantile(topology: any, p: any): any; + +export function quantize(topology: any, transform: any): any; + +export function simplify(topology: any, minWeight: any): any; + +export function sphericalRingArea(ring: any, interior: any): any; + +export function sphericalTriangleArea(t: any): any; + +export function topology(objects: any, quantization: any): any; + +export function transform(transform: any): any; + +export function untransform(transform: any): any; diff --git a/types/topojson/topojson-tests.ts b/types/topojson/topojson-tests.ts new file mode 100644 index 0000000000..a8049b6b26 --- /dev/null +++ b/types/topojson/topojson-tests.ts @@ -0,0 +1,6 @@ +import * as topojson from 'topojson'; + +// TODO: complete tests. + +topojson.feature(null, null); // $ExpectType { features: any[]; } +topojson.mesh(null, null, (a: any, b: any) => a !== b); // $ExpectType { type: any; coordinates: any[]; } diff --git a/types/topojson/tsconfig.json b/types/topojson/tsconfig.json new file mode 100644 index 0000000000..0f3148453b --- /dev/null +++ b/types/topojson/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "topojson-tests.ts" + ] +} diff --git a/types/topojson/tslint.json b/types/topojson/tslint.json new file mode 100644 index 0000000000..f9e30021f4 --- /dev/null +++ b/types/topojson/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "../tslint.json" +}