Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions types/project-osrm__osrm/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,8 @@ declare namespace OSRM {
* https://github.com/Project-OSRM/node-osrm/blob/master/docs/api.md#match
*/
interface MatchWaypoint extends Waypoint {
matchings_index: number[];
waypoint_index: number[];
matchings_index: number;
waypoint_index: number;
}

/**
Expand Down
13 changes: 13 additions & 0 deletions types/project-osrm__osrm/project-osrm__osrm-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as fs from "fs";
import OSRM = require("@project-osrm/osrm");
import assert from "assert";

// Access to Types from namespace
const tile: OSRM.Tile = [0, 0, 0];
Expand Down Expand Up @@ -145,6 +146,18 @@ osrm.match({ coordinates, timestamps, exclude }, (err, response) => {
if (err) throw err;
console.log(response.tracepoints); // array of Waypoint objects
console.log(response.matchings); // array of Route objects

response.tracepoints.forEach((tracepoint) => {
if (!tracepoint) {
return;
}

// $ExpectType number
tracepoint.matchings_index;

// $ExpectType number
tracepoint.waypoint_index;
});
});

osrm.match({ coordinates, timestamps, exclude }, { format: "object" }, (err, response) => {
Expand Down