visgl / visgl/deck.gl

[Doc]GeoJsonLayer: TypeScript example cannot be compiled

Open Beginner friendly
#9,532 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Link

https://deck.gl/docs/api-reference/layers/geojson-layer

Description

The line

getLineColor: (f: Feature<Geometry, PropertiesType>) => { … }

in the TypeScript example cannot be compiled. The error the compiler issues is:

Type '(f: Feature<Geometry, PropertiesType>) => number[] | undefined' is not assignable to type 'Accessor<Feature<Geometry, PropertiesType>, Color> | undefined'.
  Type '(f: Feature<Geometry, PropertiesType>) => number[] | undefined' is not assignable to type 'AccessorFunction<Feature<Geometry, PropertiesType>, Color>'.
    Type 'number[] | undefined' is not assignable to type 'Color'.
      Type 'undefined' is not assignable to type 'Color'.

(using typescript 5.7.3)

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

Open the GeoJsonLayer API documentation at the linked URL and inspect the TypeScript example containing the getLineColor accessor. Reproduce the reported TypeScript 5.7.3 error, then update the example so it compiles while preserving its intended behavior. Done means the documented example no longer produces the reported type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.