Open Akkuma opened 3 years ago
@Akkuma did you figure out a way to map the result of LTTB? I'm still evaluating the lib and this is the first issue I ran into.
For what it's worth, I ran into this, too. Indexable
type looks to return an array-like object, just without the correct methods on the type, so you can safely fix it by type-casting the response as an XYDataPoint
array. E.g., XYDataPoint[]
Here's what I mean. Do this:
import { ASAP, XYDataPoint } from "downsample";
...
const downsampledData = ASAP([[0, 1], [1, 2], ...], 1000) as XYDataPoint[];
// now you can treat as an array
downsampledData.map(...)
The original (incorrect) type for Indexable
is definitely missing properties of an array. Looks more like an object definition.
type Indexable<T> = {
length: number;
[index: number]: T;
};