i am trying to use redis geoadd function with nodejs client, there seems to be function provided by the client but type is messed up with typescript and i can not seem to be able to make it work, current code is
cache.geoAdd(KEY,position.longitude,position.latitude, courier_id)
and as i have read in the redis docs this should be the syntax but it returns this TS error
Type at position 2 in source is not compatible with type at position 2 in target. Type 'string' is not assignable to type 'GeoMember | GeoMember[]'
and when i check GeoMember type in node modules it is object with just member property {member: string}, so i can not figure out how to build the command since there are very low amount of resources online on redis geo. if anyone had experience with this could you elaborate how you managed to make this command work
CodePudding user response:
GeoMember extends GeoCoordinates... this should work:
await cache.geoAdd(KEY, {
longitude: position.longitude,
latitude: position.latitude,
member: courier_id
});
