Skip to content

Commit beff698

Browse files
authored
Fix interpolate typings definition (#1489)
* Fix interpolate definition * Fix code generation due to build failure * Remove unneeded code
1 parent 9d54963 commit beff698

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

build/generate-style-spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export type InterpolationSpecification =
141141
| ['linear']
142142
| ['exponential', number | ExpressionSpecification]
143143
| ['cubic-bezier', number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification, number | ExpressionSpecification]
144-
144+
145145
export type ExpressionSpecification =
146146
// types
147147
| ['array', unknown | ExpressionSpecification] // array
@@ -196,8 +196,7 @@ export type ExpressionSpecification =
196196
| ['within', unknown | ExpressionSpecification]
197197
// Ramps, scales, curves
198198
| ['interpolate', InterpolationSpecification,
199-
number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
200-
...(number | ExpressionInputType | ExpressionSpecification)[]]
199+
number | ExpressionSpecification, ...(number | ExpressionInputType | ExpressionSpecification)[]]
201200
| ['interpolate-hcl', InterpolationSpecification,
202201
number | ExpressionSpecification, number | ExpressionSpecification, ExpressionInputType | ExpressionSpecification,
203202
...(number | ColorSpecification | ExpressionSpecification)[]]

src/style-spec/feature_filter/feature_filter.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ describe('filter', () => {
3636
compileTimeCheck(['match', ['get', 'TYPE'], ['TARGETPOINT:HOSPITAL'], true, false]);
3737
compileTimeCheck(['match', ['get', 'TYPE'], ['ADIZ', 'AMA', 'AWY', 'CLASS', 'NO-FIR', 'OCA', 'OTA', 'P', 'RAS', 'RCA', 'UTA', 'UTA-P'], true, false]);
3838
compileTimeCheck(['==', ['get', 'MILITARYAIRPORT'], 1]);
39+
const colorStops = [0, 'red', 0.5, 'green', 1, 'blue'];
40+
compileTimeCheck([
41+
'interpolate',
42+
['linear'],
43+
['line-progress'],
44+
...colorStops
45+
]);
3946
});
4047

4148
test('expression, zoom', () => {

0 commit comments

Comments
 (0)