Skip to content

Commit

Permalink
Added Pathresult type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
warerebel committed Apr 5, 2022
1 parent 5a1ee30 commit a8d7530
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/openLRDecode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import type { linkLookup, node } from "./nodes";
import type { LRPObject } from "./LRP";
import type Graph from "node-dijkstra";

type PathResult = {
path: string,
cost: number
}

export interface OpenLRDecodeOptions {
searchRadius?: number | undefined;
targetBearing?: number | undefined;
Expand Down Expand Up @@ -42,7 +47,7 @@ async function buildGraph(decodedOpenLR: LRPObject, collectionName: string) {
function getPath(nodes: string[], graph: Graph) {
const paths = [];
for (let i = 0; i < (nodes.length - 1); i++) {
paths.push(graph.path(nodes[i], nodes[i + 1], { cost: true }) as Graph.PathResult);
paths.push(graph.path(nodes[i], nodes[i + 1], { cost: true }) as unknown as PathResult);
}
const result = { path: [] as string[], cost: 0 };
for (const index in paths) {
Expand Down

0 comments on commit a8d7530

Please sign in to comment.