Merge pull request #25828 from wazeHQ/mapbox__geojson-area

add types for @mapbox/geojson-area
This commit is contained in:
Ron Buckton
2018-05-17 22:04:01 -07:00
committed by GitHub
4 changed files with 57 additions and 0 deletions

12
types/mapbox__geojson-area/index.d.ts vendored Normal file
View File

@@ -0,0 +1,12 @@
// Type definitions for @mapbox/geojson-area 0.2
// Project: https://github.com/mapbox/geojson-area#readme
// Definitions by: Sagie Maoz <https://github.com/n0nick>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// tslint:disable-next-line no-single-declare-module
declare module "@mapbox/geojson-area" {
import { Geometry } from 'geojson';
function geometry(geo: Geometry): number;
}

View File

@@ -0,0 +1,21 @@
import { geometry } from '@mapbox/geojson-area';
// Using a polygon argument
// $ExpectType number
geometry({
type: "Polygon",
coordinates: [
[
[170.0, 45.0], [180.0, 45.0]
], [
[-180.0, 45.0], [-170.0, 45.0]
]
]
});
// Using a point argument
// $ExpectType number
geometry({
type: "Point",
coordinates: [12, 23]
});

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",
"mapbox__geojson-area-tests.ts"
]
}

View File

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