mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@mapbox/mapbox-sdk] Added types for mapbox-sdk-js (#37176)
* Initial commit * Prettier * 4 spaces here too * Prettier in the definitions file too * Once more * don't believe this is necessary * Followed common-mistakes * Add a comment, prettier * First test failure * TS version required by geojson * TS version required by mapbox-gl * redundant export of interfaces * jsdoc comment format on 1315 * more test suggestions * postcommit * ProgressEvent comes from the js api * Nicely format these jsdoc comments * postcommit * more fixes * more jsdoc comments, bad interface * more jsdoc comments * more comments * more jsdoc comments * remove all trailing whitespace * more comments * more docs * whitespace * postcommit * so many docs * more whitespace * more docs * more docs * whitespace * more tests * add newline, update tests
This commit is contained in:
parent
33662042fc
commit
7923edeecc
1736
types/mapbox__mapbox-sdk/index.d.ts
vendored
Normal file
1736
types/mapbox__mapbox-sdk/index.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
36
types/mapbox__mapbox-sdk/mapbox__mapbox-sdk-tests.ts
Normal file
36
types/mapbox__mapbox-sdk/mapbox__mapbox-sdk-tests.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import MapiClient, { SdkConfig } from '@mapbox/mapbox-sdk/lib/classes/mapi-client';
|
||||
import { MapiRequest } from '@mapbox/mapbox-sdk/lib/classes/mapi-request';
|
||||
import { MapiResponse } from '@mapbox/mapbox-sdk/lib/classes/mapi-response';
|
||||
import Directions, { DirectionsService, DirectionsResponse } from '@mapbox/mapbox-sdk/services/directions';
|
||||
import Styles, { StylesService } from '@mapbox/mapbox-sdk/services/styles';
|
||||
|
||||
const config: SdkConfig = {
|
||||
accessToken: 'access-token',
|
||||
};
|
||||
const client = new MapiClient(config);
|
||||
|
||||
const directionsService: DirectionsService = Directions(client);
|
||||
|
||||
const mapiRequest: MapiRequest = directionsService.getDirections({
|
||||
profile: 'walking',
|
||||
waypoints: [
|
||||
{
|
||||
coordinates: [1, 3],
|
||||
},
|
||||
{
|
||||
coordinates: [2, 4],
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
mapiRequest.send().then((response: MapiResponse) => {
|
||||
const body = response.body as DirectionsResponse;
|
||||
const route = body.routes;
|
||||
});
|
||||
|
||||
const stylesService: StylesService = Styles(config);
|
||||
stylesService.putStyleIcon({
|
||||
styleId: 'style-id',
|
||||
iconId: 'icon-id',
|
||||
file: 'path-to-file.file'
|
||||
});
|
||||
24
types/mapbox__mapbox-sdk/tsconfig.json
Normal file
24
types/mapbox__mapbox-sdk/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mapbox__mapbox-sdk-tests.ts"
|
||||
]
|
||||
}
|
||||
3
types/mapbox__mapbox-sdk/tslint.json
Normal file
3
types/mapbox__mapbox-sdk/tslint.json
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user