From a8d7530674b3a65f23187a5c520ad276c9972507 Mon Sep 17 00:00:00 2001 From: Chris Lount Date: Tue, 5 Apr 2022 15:58:19 +0100 Subject: [PATCH] Added Pathresult type declaration --- src/openLRDecode.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/openLRDecode.ts b/src/openLRDecode.ts index d35e994b8951..a4f66de5c2a3 100644 --- a/src/openLRDecode.ts +++ b/src/openLRDecode.ts @@ -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; @@ -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) {