deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Bug] minor irritation with type of `target` in accessors (e.g. `getPosition`) being incompatible with expected return type

Open xinaesthete opened this issue 1 year ago • 0 comments

Description

If we write something like

new ScatterplotLayer({
  getPosition(_, { target }) => {
    target[0] = x;
    target[1] = y;
    return target;

we get a TypeScript error, because the type of target is number[] but getPosition has to return a Position which is [number, number] | [number, number, number] | Float32Array | Float64Array... so it needs something like as [number, number]. Perhaps simplest would be for a less narrow Position type.

Flavors

  • [ ] Script tag
  • [X] React
  • [ ] Python/Jupyter notebook
  • [ ] MapboxOverlay
  • [ ] GoogleMapsOverlay
  • [ ] CartoLayer
  • [ ] ArcGIS

Expected Behavior

No response

Steps to Reproduce

Hopefully this makes sense to anyone reading without needing a specific repro.

Environment

  • Framework version: 9.0.27
  • Browser: n/a
  • OS: n/a

Logs

No response

xinaesthete avatar Aug 28 '24 13:08 xinaesthete