mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-29 00:51:29 +08:00
add types for @mapbox/geo-viewport (#27560)
This commit is contained in:
15
types/mapbox__geo-viewport/index.d.ts
vendored
Normal file
15
types/mapbox__geo-viewport/index.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// Type definitions for @mapbox/geo-viewport 0.3
|
||||
// Project: https://github.com/mapbox/geo-viewport
|
||||
// Definitions by: Fabio Berta <https://github.com/fnberta>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface GeoViewport {
|
||||
center: [number, number];
|
||||
zoom: number;
|
||||
}
|
||||
|
||||
export type BoundingBox = [number, number, number, number];
|
||||
|
||||
export function viewport(bounds: BoundingBox, dimensions: [number, number], minzoom?: number, maxzoom?: number, tileSize?: number): GeoViewport;
|
||||
|
||||
export function bounds(viewport: { lon: number; lat: number }, zoom: number, dimensions: [number, number], tileSize?: number): BoundingBox;
|
||||
13
types/mapbox__geo-viewport/mapbox__geo-viewport-tests.ts
Normal file
13
types/mapbox__geo-viewport/mapbox__geo-viewport-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { viewport, bounds } from '@mapbox/geo-viewport';
|
||||
|
||||
const geoViewport = viewport([
|
||||
5.668343999999995,
|
||||
45.111511000000014,
|
||||
5.852471999999996,
|
||||
45.26800200000002,
|
||||
], [640, 480]);
|
||||
|
||||
const boundingBox = bounds({
|
||||
lon: 100,
|
||||
lat: 200,
|
||||
}, 14, [640, 480]);
|
||||
28
types/mapbox__geo-viewport/tsconfig.json
Normal file
28
types/mapbox__geo-viewport/tsconfig.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@mapbox/geo-viewport": [
|
||||
"mapbox__geo-viewport"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mapbox__geo-viewport-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/mapbox__geo-viewport/tslint.json
Normal file
1
types/mapbox__geo-viewport/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user