mapbox / mapbox/mapbox-gl-js

Improve error reporting for assertions/coercions wrapping `['get', 'property_name']`

Open
#5,268 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

api :memo:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

By far the most common uses of type assertions and coercions will be to wrap feature property accesses, e.g. `["number", ["get", "property_name"]]` or `["to_color", ["get", "property_name"]]`. In that case, instead of just saying "Expected Number but String instead", we should say something more specific, like, "Expected feature property "property_name" to be a number, but found a string instead."

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

No files or tests are named in the issue. Start by locating the TypeScript expression handling for assertions, coercions, and feature-property access, then find its existing error tests; done means wrapped get expressions report the property name and expected and found types specifically.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.