[@types/geobuf] Add typings for geobuf project (#40532)

* Add types for geobuf

https://github.com/mapbox/geobuf

* Remove patch version from header
This commit is contained in:
Chad Burt 2019-11-20 12:34:45 -08:00 committed by Sheetal Nandi
parent b82c575b67
commit 593b226eac
4 changed files with 47 additions and 0 deletions

View File

@ -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

9
types/geobuf/index.d.ts vendored Normal file
View File

@ -0,0 +1,9 @@
// Type definitions for geobuf 3.0
// Project: https://github.com/mapbox/geobuf
// Definitions by: Chad Burt <https://github.com/DefinitelyTyped>
// 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;

View File

@ -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"
]
}

1
types/geobuf/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }