diff --git a/types/geobuf/geobuf-tests.ts b/types/geobuf/geobuf-tests.ts new file mode 100644 index 0000000000..3ca2b0c91d --- /dev/null +++ b/types/geobuf/geobuf-tests.ts @@ -0,0 +1,14 @@ +import * as geobuf from 'geobuf'; +import { GeoJSON } from 'geojson'; +import Pbf = require('pbf'); + +geobuf.decode(new Pbf(Uint8Array.from([]))); // $ExpectType GeoJSON +const geojson: GeoJSON = { + type: 'Feature', + properties: {}, + geometry: { + type: 'Point', + coordinates: [-127, 19] + } +}; +geobuf.encode(geojson, new Pbf()); // $ExpectType Uint8Array diff --git a/types/geobuf/index.d.ts b/types/geobuf/index.d.ts new file mode 100644 index 0000000000..98d0ea4055 --- /dev/null +++ b/types/geobuf/index.d.ts @@ -0,0 +1,9 @@ +// Type definitions for geobuf 3.0 +// Project: https://github.com/mapbox/geobuf +// Definitions by: Chad Burt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import Pbf = require('pbf'); +import { GeoJSON } from 'geojson'; + +export function decode(pbf: Pbf): GeoJSON; +export function encode(obj: GeoJSON, pbf: Pbf): Uint8Array; diff --git a/types/geobuf/tsconfig.json b/types/geobuf/tsconfig.json new file mode 100644 index 0000000000..2a94e75656 --- /dev/null +++ b/types/geobuf/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "geobuf-tests.ts" + ] +} diff --git a/types/geobuf/tslint.json b/types/geobuf/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/geobuf/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }