mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add typings for geopoint (#43158)
This adds a type definition for the geopoint npm package
This commit is contained in:
parent
eea1cfb40e
commit
b2d4d29f9f
21
types/geopoint/geopoint-tests.ts
Normal file
21
types/geopoint/geopoint-tests.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import GeoPoint = require("geopoint");
|
||||
|
||||
function test() {
|
||||
const geopoint: GeoPoint = new GeoPoint(2.33, 4.66, false);
|
||||
|
||||
const boundingCoords: [GeoPoint, GeoPoint] = geopoint.boundingCoordinates(5, 12, true);
|
||||
|
||||
const distanceTo: number = geopoint.distanceTo(new GeoPoint(4.20, 6.9));
|
||||
|
||||
const latitude: number = geopoint.latitude(false);
|
||||
|
||||
const longitude: number = geopoint.longitude(true);
|
||||
|
||||
const degToRad: number = GeoPoint.degreesToRadians(1);
|
||||
|
||||
const kmToMiles: number = GeoPoint.kilometersToMiles(13.33333);
|
||||
|
||||
const milesToKm: number = GeoPoint.milesToKilometers(666);
|
||||
|
||||
const radToDeg: number = GeoPoint.radiansToDegrees(3);
|
||||
}
|
||||
26
types/geopoint/index.d.ts
vendored
Normal file
26
types/geopoint/index.d.ts
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
// Type definitions for geopoint 1.0
|
||||
// Project: https://github.com/davidwood/node-geopoint
|
||||
// Definitions by: Varg Industries <https://github.com/vargind>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = GeoPoint;
|
||||
|
||||
declare class GeoPoint {
|
||||
constructor(lat: number, lon: number, inRadians?: boolean);
|
||||
|
||||
boundingCoordinates(distance: number, radius: number, inKilometers?: boolean): [GeoPoint, GeoPoint];
|
||||
|
||||
distanceTo(point: GeoPoint, inKilometers?: boolean): number;
|
||||
|
||||
latitude(inRadians?: boolean): number;
|
||||
|
||||
longitude(inRadians?: boolean): number;
|
||||
|
||||
static degreesToRadians(value: number): number;
|
||||
|
||||
static kilometersToMiles(value: number): number;
|
||||
|
||||
static milesToKilometers(value: number): number;
|
||||
|
||||
static radiansToDegrees(value: number): number;
|
||||
}
|
||||
23
types/geopoint/tsconfig.json
Normal file
23
types/geopoint/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"geopoint-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/geopoint/tslint.json
Normal file
1
types/geopoint/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user