[Doc]GeoJsonLayer: TypeScript example cannot be compiled
Open
Beginner friendly
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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