visgl / visgl/deck.gl

getText accessor function parameter not typed in GeoJsonLayer

Open
#9,020 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
14.6k
Forks
2.3k
Avg merge
2d 9h
Merged PRs (30d)
42

Description

Description

The parameter for the getText accessor is not typed.

Flavors
  • Script tag
  • React
  • Python/Jupyter notebook
  • MapboxOverlay
  • GoogleMapsOverlay
  • CartoLayer
  • ArcGIS
Expected Behavior

In getText: (f) => ... f should have type Feature<Geometry, PropertiesType>

Steps to Reproduce

https://stackblitz.com/edit/vitejs-vite-musbxe?file=main.ts

const layer = new GeoJsonLayer<PropertiesType>({
    id: 'GeoJsonLayer',
    data: 'https://raw.githubusercontent.com/visgl/deck.gl-data/master/website/bart.geo.json',
    pointType: 'circle+text',
    // getText: (f: Feature<Geometry, PropertiesType>) => f.properties.name,
    getText: (f) => f.properties.name, // f should automatically have the correct type
    getFillColor: (f) => [0, 0, 0], // f automatically has the correct type
  });
Environment
  • Framework version: 9.0.21
Logs

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the GeoJsonLayer TypeScript accessor definitions and use the linked StackBlitz reproduction to compare getText with the already-typed getFillColor accessor. Done means the getText callback parameter is inferred as Feature<Geometry, PropertiesType> in the provided example without an explicit annotation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.