Document filter heuristic for determining if it uses an expression or deprecated syntax
@danswick 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**:
Latest version
### Steps to Trigger Behavior
1. Use the expression `['!', ['<', 'startDateTs', 1515283200000]]`
### Link to Demonstration
```
const featureFilter = require('@mapbox/mapbox-gl-style-spec').featureFilter;
const example = featureFilter(
['!', ['<', 'startDateTs', 1515283200000]]
);
```
### Expected Behavior
No error. I would expect `startDateTs` to be interpreted as a property of the feature.
### Actual Behavior
An exception:
```
[....]/node_modules/@mapbox/mapbox-gl-style-spec/dist/index.js:11410
throw new Error(compiled.value.map(function (err) {
^
Error: [1][1]: Cannot compare types 'string' and 'number'.
at createFilter (/[...]/node_modules/@mapbox/mapbox-gl-style-spec/dist/index.js:11410:17)
```
If I remove "!" from the expression it works.
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.