mapbox / mapbox/mapbox-gl-js

Document filter heuristic for determining if it uses an expression or deprecated syntax

Open
#7,937 2 comments 0 reactions 1 assignee View on GitHub

@danswick is already working on this.

Since Jul 9, 2021.

docs :scroll: style-spec
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

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.