get expression - unclear syntax
@swoloszynski is already working on this.
Since Jul 9, 2021.
- Dominant language
- TypeScript
- Stars
- 12.4k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
mapbox-gl-js version: 0.44.2
Steps to Trigger Behavior
Get expression syntax is not defined well in the documentation: it is not clear when it is necessary to use type expressions (for ex. issue 6479 ).
For now, my code looks like this (and it doesn't work without type expressions):
['get', 'line-opacity', ['object', ['get', ['string', ['get', FeatureProperties.LineType]], ['literal', this.lineStyles]]]]
And it is not clear when I have to use ['object',{...}], ['literal', {...}] or ['string',{...}]. And at the same time, in case expression I can write something like this:
'line-color': [ 'case', ['has', 'line-color'], ['get', 'line-color']]
without this type-casting magic. I would expect expressions to work in the same manner and a better description in the official documentation.
Expected Behavior
The same behavior for all expressions, proper description in the docs
Actual Behavior
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.
Assessment
This issue has not been assessed yet.