Multivariable typescript functions in Workshop Map widget geometry

I’m working on visualizing voyages between GeoPoints on a map widget in Workshop. After the application user filters an ObjectSet, I’d like to display routes (the fixed paths between two GeoPoints) as lines whose width scales with the number of voyages along that route.

I tried implementing a TypeScript function to aggregate voyage counts per route:

import { Function, FunctionsMap, Double } from "@foundry/functions-api";
import { Route, Voyage, ObjectSet } from "@foundry/ontology-api";

export class RouteFunctions {
    @Function()
    public async sumVoyageCounts(
        routes: Route[],
        voyages: ObjectSet<Voyage>,
    ): Promise<FunctionsMap<Route, Double>> {
        const aggregationsPromise = voyages.groupBy(voyage => voyage.RouteId.exactValues({maxBuckets: 10_000})).sum(voyage => voyage.count)
        let aggregationsMap = new Map<String, Double>
        const aggregations = await aggregationsPromise
        aggregations.buckets.forEach(bucket => aggregationsMap.set(bucket.key, bucket.value))
        const result = new FunctionsMap<Route, number>
        routes.forEach(route => result.set(route, aggregationsMap.get(route.RouteUniqueIdentifier) ?? 0))
        return result
    }
}

The issue: I haven’t been able to pass an ObjectSet as the second parameter. Tests confirm that numeric values work, but ObjectSets fail.

My question: Is there a way to pass an ObjectSet in this context, or is there a different approach I should be using to achieve route-based aggregation?

Relevant Documentation:
Map • Integrate data for the map • Functions for the map • Palantir

I am now able to pass ObjectSets in as arguments, so my Map widget is now working as intended.