[@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:
Jeff Dye 2019-07-31 16:58:03 -04:00 committed by Jesse Trinity
parent 33662042fc
commit 7923edeecc
4 changed files with 1799 additions and 0 deletions

1736
types/mapbox__mapbox-sdk/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View 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'
});

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

View File

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