filter and algorithm should be made optional.
shixish opened this issue · 1 comments
shixish commented
I added the question marks (?) to the opts object. This was causing my code to throw errors since I was only using filter and not specifying the algorithm (using the default).
/**
* Find an object with the shortest path from the given position. Uses A* search algorithm and Dijkstra's algorithm.
* @param type See Room.find
* @param opts An object containing pathfinding options (see Room.findPath), or one of the following: filter, algorithm
*/
findClosestByPath<T>(type: number, opts?: {
filter?: any | string;
algorithm?: string;
}): T;
/**
* Find an object with the shortest path from the given position. Uses A* search algorithm and Dijkstra's algorithm.
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
* @param opts An object containing pathfinding options (see Room.findPath), or one of the following: filter, algorithm
*/
findClosestByPath<T>(objects: [T | RoomPosition], opts?: {
filter?: any | string;
algorithm?: string;
}): T;
MarkoSulamagi commented
I also found some other methods where this was the case. Fixed it and released new version.
Thanks for your help!