@mapbox/mapbox-gl-style-spec 14.28.0 → 14.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/composite.ts +5 -5
  2. package/diff.ts +38 -40
  3. package/dist/index.cjs +362 -238
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +101 -13
  6. package/dist/index.es.js +362 -238
  7. package/dist/index.es.js.map +1 -1
  8. package/expression/compound_expression.ts +6 -6
  9. package/expression/definitions/assertion.ts +9 -12
  10. package/expression/definitions/at.ts +1 -1
  11. package/expression/definitions/at_interpolated.ts +1 -1
  12. package/expression/definitions/case.ts +1 -2
  13. package/expression/definitions/coalesce.ts +1 -1
  14. package/expression/definitions/coercion.ts +10 -12
  15. package/expression/definitions/collator.ts +8 -8
  16. package/expression/definitions/comparison.ts +0 -1
  17. package/expression/definitions/distance.ts +135 -73
  18. package/expression/definitions/format.ts +10 -13
  19. package/expression/definitions/image.ts +8 -8
  20. package/expression/definitions/index.ts +92 -90
  21. package/expression/definitions/interpolate.ts +18 -19
  22. package/expression/definitions/let.ts +1 -2
  23. package/expression/definitions/literal.ts +1 -1
  24. package/expression/definitions/match.ts +7 -8
  25. package/expression/definitions/number_format.ts +7 -8
  26. package/expression/definitions/step.ts +11 -11
  27. package/expression/definitions/within.ts +23 -24
  28. package/expression/evaluation_context.ts +4 -4
  29. package/expression/expression.ts +1 -1
  30. package/expression/index.ts +43 -21
  31. package/expression/parsing_context.ts +2 -2
  32. package/expression/stops.ts +2 -2
  33. package/expression/values.ts +2 -2
  34. package/feature_filter/index.ts +3 -3
  35. package/function/convert.ts +8 -8
  36. package/function/index.ts +4 -2
  37. package/group_by_layout.ts +6 -4
  38. package/package.json +1 -1
  39. package/read_style.ts +2 -2
  40. package/reference/v8.json +86 -5
  41. package/types/config_options.ts +1 -1
  42. package/types.ts +16 -6
  43. package/util/properties.ts +1 -1
  44. package/validate/validate.ts +15 -5
  45. package/validate/validate_appearance.ts +7 -7
  46. package/validate/validate_array.ts +7 -7
  47. package/validate/validate_enum.ts +2 -3
  48. package/validate/validate_fog.ts +2 -2
  49. package/validate/validate_function.ts +14 -13
  50. package/validate/validate_layer.ts +10 -9
  51. package/validate/validate_light.ts +2 -2
  52. package/validate/validate_lights.ts +3 -3
  53. package/validate/validate_number.ts +10 -7
  54. package/validate/validate_object.ts +11 -10
  55. package/validate/validate_option.ts +24 -9
  56. package/validate/validate_property.ts +4 -4
  57. package/validate/validate_rain.ts +1 -1
  58. package/validate/validate_snow.ts +1 -1
  59. package/validate/validate_style.ts +2 -1
  60. package/validate/validate_terrain.ts +2 -2
  61. package/validate_mapbox_api_supported.ts +5 -6
  62. package/validate_style.min.ts +2 -1
  63. package/visit.ts +11 -10
@@ -51,6 +51,8 @@ import type EvaluationContext from '../evaluation_context';
51
51
  import type {Varargs} from '../compound_expression';
52
52
  import type {Expression, ExpressionRegistry} from '../expression';
53
53
 
54
+ type LegacyFilterValue = string | number | boolean;
55
+
54
56
  const expressions: ExpressionRegistry = {
55
57
  // special forms
56
58
  '==': Equals,
@@ -93,11 +95,11 @@ const expressions: ExpressionRegistry = {
93
95
 
94
96
  function rgba(ctx: EvaluationContext, [r, g, b, a]: Expression[]) {
95
97
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
96
- r = r.evaluate(ctx);
98
+ r = r!.evaluate(ctx);
97
99
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
98
- g = g.evaluate(ctx);
100
+ g = g!.evaluate(ctx);
99
101
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
100
- b = b.evaluate(ctx);
102
+ b = b!.evaluate(ctx);
101
103
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
102
104
  const alpha = a ? a.evaluate(ctx) : 1;
103
105
  const error = validateRGBA(r, g, b, alpha);
@@ -108,11 +110,11 @@ function rgba(ctx: EvaluationContext, [r, g, b, a]: Expression[]) {
108
110
 
109
111
  function hsla(ctx: EvaluationContext, [h, s, l, a]: Expression[]) {
110
112
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
111
- h = h.evaluate(ctx);
113
+ h = h!.evaluate(ctx);
112
114
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
113
- s = s.evaluate(ctx);
115
+ s = s!.evaluate(ctx);
114
116
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
115
- l = l.evaluate(ctx);
117
+ l = l!.evaluate(ctx);
116
118
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
117
119
  const alpha = a ? a.evaluate(ctx) : 1;
118
120
  const error = validateHSLA(h, s, l, alpha);
@@ -133,12 +135,12 @@ function get<T extends object>(key: keyof T, obj: T): T[keyof T] | null {
133
135
  return typeof v === 'undefined' ? null : v;
134
136
  }
135
137
 
136
- function binarySearch(v: unknown, a: Record<number, unknown>, i: number, j: number): boolean {
138
+ function binarySearch(v: LegacyFilterValue, a: Record<number, LegacyFilterValue>, i: number, j: number): boolean {
137
139
  while (i <= j) {
138
140
  const m = (i + j) >> 1;
139
141
  if (a[m] === v)
140
142
  return true;
141
- if (a[m] > v)
143
+ if (a[m]! > v)
142
144
  j = m - 1;
143
145
  else
144
146
  i = m + 1;
@@ -179,20 +181,20 @@ CompoundExpression.register(expressions, {
179
181
  ErrorType,
180
182
  [StringType],
181
183
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
182
- (ctx, [v]) => { throw new RuntimeError(v.evaluate(ctx)); }
184
+ (ctx, [v]) => { throw new RuntimeError(v!.evaluate(ctx)); }
183
185
  ],
184
186
  'typeof': [
185
187
  StringType,
186
188
  [ValueType],
187
189
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
188
- (ctx, [v]) => typeToString(typeOf(v.evaluate(ctx)))
190
+ (ctx, [v]) => typeToString(typeOf(v!.evaluate(ctx)))
189
191
  ],
190
192
  'to-rgba': [
191
193
  array(NumberType, 4),
192
194
  [ColorType],
193
195
  (ctx, [v]) => {
194
196
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
195
- return v.evaluate(ctx).toNonPremultipliedRenderColor(null).toArray();
197
+ return v!.evaluate(ctx).toNonPremultipliedRenderColor(null).toArray();
196
198
  }
197
199
  ],
198
200
  'to-hsla': [
@@ -200,7 +202,7 @@ CompoundExpression.register(expressions, {
200
202
  [ColorType],
201
203
  (ctx, [v]) => {
202
204
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
203
- return v.evaluate(ctx).toNonPremultipliedRenderColor(null).toHslaArray();
205
+ return v!.evaluate(ctx).toNonPremultipliedRenderColor(null).toHslaArray();
204
206
  }
205
207
  ],
206
208
  'rgb': [
@@ -229,11 +231,11 @@ CompoundExpression.register(expressions, {
229
231
  [
230
232
  [StringType],
231
233
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
232
- (ctx, [key]) => has(key.evaluate(ctx), ctx.properties())
234
+ (ctx, [key]) => has(key!.evaluate(ctx), ctx.properties())
233
235
  ], [
234
236
  [StringType, ObjectType],
235
237
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
236
- (ctx, [key, obj]) => has(key.evaluate(ctx), obj.evaluate(ctx))
238
+ (ctx, [key, obj]) => has(key!.evaluate(ctx), obj!.evaluate(ctx))
237
239
  ]
238
240
  ]
239
241
  },
@@ -243,11 +245,11 @@ CompoundExpression.register(expressions, {
243
245
  [
244
246
  [StringType],
245
247
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
246
- (ctx, [key]) => get(key.evaluate(ctx), ctx.properties())
248
+ (ctx, [key]) => get(key!.evaluate(ctx), ctx.properties())
247
249
  ], [
248
250
  [StringType, ObjectType],
249
251
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-argument
250
- (ctx, [key, obj]) => get(key.evaluate(ctx), obj.evaluate(ctx))
252
+ (ctx, [key, obj]) => get(key!.evaluate(ctx), obj!.evaluate(ctx))
251
253
  ]
252
254
  ]
253
255
  },
@@ -255,7 +257,7 @@ CompoundExpression.register(expressions, {
255
257
  ValueType,
256
258
  [StringType],
257
259
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
258
- (ctx, [key]) => get(key.evaluate(ctx), ctx.featureState || {}) as Value
260
+ (ctx, [key]) => get(key!.evaluate(ctx), ctx.featureState || {}) as Value
259
261
  ],
260
262
  'properties': [
261
263
  ObjectType,
@@ -270,7 +272,7 @@ CompoundExpression.register(expressions, {
270
272
  'worldview': [
271
273
  StringType,
272
274
  [],
273
- (ctx) => ctx.globals.worldview || ""
275
+ (ctx) => ctx.globals!.worldview || ""
274
276
  ],
275
277
  'is-active-floor': [
276
278
  BooleanType,
@@ -279,7 +281,7 @@ CompoundExpression.register(expressions, {
279
281
  const hasActiveFloors = ctx.globals && ctx.globals.activeFloors && ctx.globals.activeFloors.size > 0;
280
282
  if (!hasActiveFloors) { return false; }
281
283
  if (args.length === 0) { return true; }
282
- const floorIds: Set<string> = ctx.globals.activeFloors;
284
+ const floorIds: Set<string> = ctx.globals!.activeFloors!;
283
285
  return args.some(arg => {
284
286
  const value = arg.evaluate(ctx) as string;
285
287
  return floorIds.has(value);
@@ -294,12 +296,12 @@ CompoundExpression.register(expressions, {
294
296
  'zoom': [
295
297
  NumberType,
296
298
  [],
297
- (ctx) => ctx.globals.zoom
299
+ (ctx) => ctx.globals!.zoom
298
300
  ],
299
301
  'pitch': [
300
302
  NumberType,
301
303
  [],
302
- (ctx) => ctx.globals.pitch || 0
304
+ (ctx) => ctx.globals!.pitch || 0
303
305
  ],
304
306
  'distance-from-center': [
305
307
  NumberType,
@@ -310,37 +312,37 @@ CompoundExpression.register(expressions, {
310
312
  NumberType,
311
313
  [StringType],
312
314
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
313
- (ctx, [s]) => ctx.measureLight(s.evaluate(ctx))
315
+ (ctx, [s]) => ctx.measureLight(s!.evaluate(ctx))
314
316
  ],
315
317
  'heatmap-density': [
316
318
  NumberType,
317
319
  [],
318
- (ctx) => ctx.globals.heatmapDensity || 0
320
+ (ctx) => ctx.globals!.heatmapDensity || 0
319
321
  ],
320
322
  'line-progress': [
321
323
  NumberType,
322
324
  [],
323
- (ctx) => ctx.globals.lineProgress || 0
325
+ (ctx) => ctx.globals!.lineProgress || 0
324
326
  ],
325
327
  'raster-value': [
326
328
  NumberType,
327
329
  [],
328
- (ctx) => ctx.globals.rasterValue || 0
330
+ (ctx) => ctx.globals!.rasterValue || 0
329
331
  ],
330
332
  'raster-particle-speed': [
331
333
  NumberType,
332
334
  [],
333
- (ctx) => ctx.globals.rasterParticleSpeed || 0
335
+ (ctx) => ctx.globals!.rasterParticleSpeed || 0
334
336
  ],
335
337
  'sky-radial-progress': [
336
338
  NumberType,
337
339
  [],
338
- (ctx) => ctx.globals.skyRadialProgress || 0
340
+ (ctx) => ctx.globals!.skyRadialProgress || 0
339
341
  ],
340
342
  'accumulated': [
341
343
  ValueType,
342
344
  [],
343
- (ctx) => (ctx.globals.accumulated === undefined ? null : ctx.globals.accumulated)
345
+ (ctx) => (ctx.globals!.accumulated === undefined ? null : ctx.globals!.accumulated)
344
346
  ],
345
347
  '+': [
346
348
  NumberType,
@@ -369,22 +371,22 @@ CompoundExpression.register(expressions, {
369
371
  overloads: [
370
372
  [
371
373
  [NumberType, NumberType],
372
- (ctx, [a, b]) => a.evaluate(ctx) - b.evaluate(ctx)
374
+ (ctx, [a, b]) => a!.evaluate(ctx) - b!.evaluate(ctx)
373
375
  ], [
374
376
  [NumberType],
375
- (ctx, [a]) => -a.evaluate(ctx)
377
+ (ctx, [a]) => -a!.evaluate(ctx)
376
378
  ]
377
379
  ]
378
380
  },
379
381
  '/': [
380
382
  NumberType,
381
383
  [NumberType, NumberType],
382
- (ctx, [a, b]) => a.evaluate(ctx) / b.evaluate(ctx)
384
+ (ctx, [a, b]) => a!.evaluate(ctx) / b!.evaluate(ctx)
383
385
  ],
384
386
  '%': [
385
387
  NumberType,
386
388
  [NumberType, NumberType],
387
- (ctx, [a, b]) => a.evaluate(ctx) % b.evaluate(ctx)
389
+ (ctx, [a, b]) => a!.evaluate(ctx) % b!.evaluate(ctx)
388
390
  ],
389
391
  'ln2': [
390
392
  NumberType,
@@ -405,67 +407,67 @@ CompoundExpression.register(expressions, {
405
407
  NumberType,
406
408
  [NumberType, NumberType],
407
409
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
408
- (ctx, [b, e]) => Math.pow(b.evaluate(ctx), e.evaluate(ctx))
410
+ (ctx, [b, e]) => Math.pow(b!.evaluate(ctx), e!.evaluate(ctx))
409
411
  ],
410
412
  'sqrt': [
411
413
  NumberType,
412
414
  [NumberType],
413
415
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
414
- (ctx, [x]) => Math.sqrt(x.evaluate(ctx))
416
+ (ctx, [x]) => Math.sqrt(x!.evaluate(ctx))
415
417
  ],
416
418
  'log10': [
417
419
  NumberType,
418
420
  [NumberType],
419
421
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
420
- (ctx, [n]) => Math.log(n.evaluate(ctx)) / Math.LN10
422
+ (ctx, [n]) => Math.log(n!.evaluate(ctx)) / Math.LN10
421
423
  ],
422
424
  'ln': [
423
425
  NumberType,
424
426
  [NumberType],
425
427
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
426
- (ctx, [n]) => Math.log(n.evaluate(ctx))
428
+ (ctx, [n]) => Math.log(n!.evaluate(ctx))
427
429
  ],
428
430
  'log2': [
429
431
  NumberType,
430
432
  [NumberType],
431
433
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
432
- (ctx, [n]) => Math.log2(n.evaluate(ctx))
434
+ (ctx, [n]) => Math.log2(n!.evaluate(ctx))
433
435
  ],
434
436
  'sin': [
435
437
  NumberType,
436
438
  [NumberType],
437
439
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
438
- (ctx, [n]) => Math.sin(n.evaluate(ctx))
440
+ (ctx, [n]) => Math.sin(n!.evaluate(ctx))
439
441
  ],
440
442
  'cos': [
441
443
  NumberType,
442
444
  [NumberType],
443
445
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
444
- (ctx, [n]) => Math.cos(n.evaluate(ctx))
446
+ (ctx, [n]) => Math.cos(n!.evaluate(ctx))
445
447
  ],
446
448
  'tan': [
447
449
  NumberType,
448
450
  [NumberType],
449
451
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
450
- (ctx, [n]) => Math.tan(n.evaluate(ctx))
452
+ (ctx, [n]) => Math.tan(n!.evaluate(ctx))
451
453
  ],
452
454
  'asin': [
453
455
  NumberType,
454
456
  [NumberType],
455
457
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
456
- (ctx, [n]) => Math.asin(n.evaluate(ctx))
458
+ (ctx, [n]) => Math.asin(n!.evaluate(ctx))
457
459
  ],
458
460
  'acos': [
459
461
  NumberType,
460
462
  [NumberType],
461
463
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
462
- (ctx, [n]) => Math.acos(n.evaluate(ctx))
464
+ (ctx, [n]) => Math.acos(n!.evaluate(ctx))
463
465
  ],
464
466
  'atan': [
465
467
  NumberType,
466
468
  [NumberType],
467
469
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
468
- (ctx, [n]) => Math.atan(n.evaluate(ctx))
470
+ (ctx, [n]) => Math.atan(n!.evaluate(ctx))
469
471
  ],
470
472
  'min': [
471
473
  NumberType,
@@ -483,14 +485,14 @@ CompoundExpression.register(expressions, {
483
485
  NumberType,
484
486
  [NumberType],
485
487
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
486
- (ctx, [n]) => Math.abs(n.evaluate(ctx))
488
+ (ctx, [n]) => Math.abs(n!.evaluate(ctx))
487
489
  ],
488
490
  'round': [
489
491
  NumberType,
490
492
  [NumberType],
491
493
  (ctx, [n]) => {
492
494
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
493
- const v = n.evaluate(ctx);
495
+ const v = n!.evaluate(ctx);
494
496
  // Javascript's Math.round() rounds towards +Infinity for halfway
495
497
  // values, even when they're negative. It's more common to round
496
498
  // away from 0 (e.g., this is what python and C++ do)
@@ -502,39 +504,39 @@ CompoundExpression.register(expressions, {
502
504
  NumberType,
503
505
  [NumberType],
504
506
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
505
- (ctx, [n]) => Math.floor(n.evaluate(ctx))
507
+ (ctx, [n]) => Math.floor(n!.evaluate(ctx))
506
508
  ],
507
509
  'ceil': [
508
510
  NumberType,
509
511
  [NumberType],
510
512
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
511
- (ctx, [n]) => Math.ceil(n.evaluate(ctx))
513
+ (ctx, [n]) => Math.ceil(n!.evaluate(ctx))
512
514
  ],
513
515
  'filter-==': [
514
516
  BooleanType,
515
517
  [StringType, ValueType],
516
518
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
517
- (ctx, [k, v]) => ctx.properties()[(k).value] === (v).value
519
+ (ctx, [k, v]) => ctx.properties()[(k!).value] === (v!).value
518
520
  ],
519
521
  'filter-id-==': [
520
522
  BooleanType,
521
523
  [ValueType],
522
- (ctx, [v]) => ctx.id() === (v).value
524
+ (ctx, [v]) => ctx.id() === (v!).value
523
525
  ],
524
526
  'filter-type-==': [
525
527
  BooleanType,
526
528
  [StringType],
527
- (ctx, [v]) => ctx.geometryType() === (v).value
529
+ (ctx, [v]) => ctx.geometryType() === (v!).value
528
530
  ],
529
531
  'filter-<': [
530
532
  BooleanType,
531
533
  [StringType, ValueType],
532
534
  (ctx, [k, v]) => {
533
535
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
534
- const a = ctx.properties()[(k).value];
536
+ const a = ctx.properties()[(k!).value];
535
537
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
536
- const b = (v).value;
537
- return typeof a === typeof b && a < b;
538
+ const b = (v!).value;
539
+ return typeof a === typeof b && (a as LegacyFilterValue) < b;
538
540
  }
539
541
  ],
540
542
  'filter-id-<': [
@@ -543,8 +545,8 @@ CompoundExpression.register(expressions, {
543
545
  (ctx, [v]) => {
544
546
  const a = ctx.id();
545
547
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
546
- const b = (v).value;
547
- return typeof a === typeof b && a < b;
548
+ const b = (v!).value;
549
+ return typeof a === typeof b && a! < b;
548
550
  }
549
551
  ],
550
552
  'filter->': [
@@ -552,10 +554,10 @@ CompoundExpression.register(expressions, {
552
554
  [StringType, ValueType],
553
555
  (ctx, [k, v]) => {
554
556
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
555
- const a = ctx.properties()[(k).value];
557
+ const a = ctx.properties()[(k!).value];
556
558
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
557
- const b = (v).value;
558
- return typeof a === typeof b && a > b;
559
+ const b = (v!).value;
560
+ return typeof a === typeof b && (a as LegacyFilterValue) > b;
559
561
  }
560
562
  ],
561
563
  'filter-id->': [
@@ -564,8 +566,8 @@ CompoundExpression.register(expressions, {
564
566
  (ctx, [v]) => {
565
567
  const a = ctx.id();
566
568
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
567
- const b = (v).value;
568
- return typeof a === typeof b && a > b;
569
+ const b = (v!).value;
570
+ return typeof a === typeof b && a! > b;
569
571
  }
570
572
  ],
571
573
  'filter-<=': [
@@ -573,10 +575,10 @@ CompoundExpression.register(expressions, {
573
575
  [StringType, ValueType],
574
576
  (ctx, [k, v]) => {
575
577
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
576
- const a = ctx.properties()[(k).value];
578
+ const a = ctx.properties()[(k!).value];
577
579
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
578
- const b = (v).value;
579
- return typeof a === typeof b && a <= b;
580
+ const b = (v!).value;
581
+ return typeof a === typeof b && (a as LegacyFilterValue) <= b;
580
582
  }
581
583
  ],
582
584
  'filter-id-<=': [
@@ -585,8 +587,8 @@ CompoundExpression.register(expressions, {
585
587
  (ctx, [v]) => {
586
588
  const a = ctx.id();
587
589
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
588
- const b = (v).value;
589
- return typeof a === typeof b && a <= b;
590
+ const b = (v!).value;
591
+ return typeof a === typeof b && a! <= b;
590
592
  }
591
593
  ],
592
594
  'filter->=': [
@@ -594,10 +596,10 @@ CompoundExpression.register(expressions, {
594
596
  [StringType, ValueType],
595
597
  (ctx, [k, v]) => {
596
598
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
597
- const a = ctx.properties()[(k).value];
599
+ const a = ctx.properties()[(k!).value];
598
600
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
599
- const b = (v).value;
600
- return typeof a === typeof b && a >= b;
601
+ const b = (v!).value;
602
+ return typeof a === typeof b && (a as LegacyFilterValue) >= b;
601
603
  }
602
604
  ],
603
605
  'filter-id->=': [
@@ -606,14 +608,14 @@ CompoundExpression.register(expressions, {
606
608
  (ctx, [v]) => {
607
609
  const a = ctx.id();
608
610
  // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
609
- const b = (v).value;
610
- return typeof a === typeof b && a >= b;
611
+ const b = (v!).value;
612
+ return typeof a === typeof b && a! >= b;
611
613
  }
612
614
  ],
613
615
  'filter-has': [
614
616
  BooleanType,
615
617
  [ValueType],
616
- (ctx, [k]) => (k).value in ctx.properties()
618
+ (ctx, [k]) => (k!).value in ctx.properties()
617
619
  ],
618
620
  'filter-has-id': [
619
621
  BooleanType,
@@ -624,27 +626,27 @@ CompoundExpression.register(expressions, {
624
626
  BooleanType,
625
627
  [array(StringType)],
626
628
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
627
- (ctx, [v]) => (v).value.includes(ctx.geometryType())
629
+ (ctx, [v]) => (v!).value.includes(ctx.geometryType())
628
630
  ],
629
631
  'filter-id-in': [
630
632
  BooleanType,
631
633
  [array(ValueType)],
632
634
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
633
- (ctx, [v]) => (v).value.includes(ctx.id())
635
+ (ctx, [v]) => (v!).value.includes(ctx.id())
634
636
  ],
635
637
  'filter-in-small': [
636
638
  BooleanType,
637
639
  [StringType, array(ValueType)],
638
640
  // assumes v is an array literal
639
641
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
640
- (ctx, [k, v]) => (v).value.includes(ctx.properties()[(k).value])
642
+ (ctx, [k, v]) => (v!).value.includes(ctx.properties()[(k!).value])
641
643
  ],
642
644
  'filter-in-large': [
643
645
  BooleanType,
644
646
  [StringType, array(ValueType)],
645
647
  // assumes v is a array literal with values sorted in ascending order and of a single type
646
648
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument
647
- (ctx, [k, v]) => binarySearch(ctx.properties()[(k).value], (v).value, 0, (v).value.length - 1)
649
+ (ctx, [k, v]) => binarySearch(ctx.properties()[(k!).value] as LegacyFilterValue, (v!).value, 0, (v!).value.length - 1)
648
650
  ],
649
651
  'all': {
650
652
  type: BooleanType,
@@ -652,7 +654,7 @@ CompoundExpression.register(expressions, {
652
654
  [
653
655
  [BooleanType, BooleanType],
654
656
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
655
- (ctx, [a, b]) => a.evaluate(ctx) && b.evaluate(ctx)
657
+ (ctx, [a, b]) => a!.evaluate(ctx) && b!.evaluate(ctx)
656
658
  ],
657
659
  [
658
660
  varargs(BooleanType),
@@ -672,7 +674,7 @@ CompoundExpression.register(expressions, {
672
674
  [
673
675
  [BooleanType, BooleanType],
674
676
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
675
- (ctx, [a, b]) => a.evaluate(ctx) || b.evaluate(ctx)
677
+ (ctx, [a, b]) => a!.evaluate(ctx) || b!.evaluate(ctx)
676
678
  ],
677
679
  [
678
680
  varargs(BooleanType),
@@ -689,7 +691,7 @@ CompoundExpression.register(expressions, {
689
691
  '!': [
690
692
  BooleanType,
691
693
  [BooleanType],
692
- (ctx, [b]) => !b.evaluate(ctx)
694
+ (ctx, [b]) => !b!.evaluate(ctx)
693
695
  ],
694
696
  'is-supported-script': [
695
697
  BooleanType,
@@ -699,7 +701,7 @@ CompoundExpression.register(expressions, {
699
701
  const isSupportedScript = ctx.globals && ctx.globals.isSupportedScript;
700
702
  if (isSupportedScript) {
701
703
  // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
702
- return isSupportedScript(s.evaluate(ctx));
704
+ return isSupportedScript(s!.evaluate(ctx));
703
705
  }
704
706
  return true;
705
707
  }
@@ -708,13 +710,13 @@ CompoundExpression.register(expressions, {
708
710
  StringType,
709
711
  [StringType],
710
712
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
711
- (ctx, [s]) => s.evaluate(ctx).toUpperCase()
713
+ (ctx, [s]) => s!.evaluate(ctx).toUpperCase()
712
714
  ],
713
715
  'downcase': [
714
716
  StringType,
715
717
  [StringType],
716
718
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
717
- (ctx, [s]) => s.evaluate(ctx).toLowerCase()
719
+ (ctx, [s]) => s!.evaluate(ctx).toLowerCase()
718
720
  ],
719
721
  'concat': [
720
722
  StringType,
@@ -726,14 +728,14 @@ CompoundExpression.register(expressions, {
726
728
  array(StringType),
727
729
  [StringType, StringType],
728
730
  // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
729
- (ctx, [str, delimiter]) => str.evaluate(ctx).split(delimiter.evaluate(ctx))
731
+ (ctx, [str, delimiter]) => str!.evaluate(ctx).split(delimiter!.evaluate(ctx))
730
732
  ],
731
733
  'in': [
732
734
  BooleanType,
733
735
  [ValueType, ValueType],
734
736
  (ctx, [needleExpr, haystackExpr]) => {
735
- const needle = needleExpr.evaluate(ctx) as Value;
736
- const haystack = haystackExpr.evaluate(ctx) as Value;
737
+ const needle = needleExpr!.evaluate(ctx) as Value;
738
+ const haystack = haystackExpr!.evaluate(ctx) as Value;
737
739
  if (haystack == null) return false;
738
740
  assertNeedleHaystack(needle, haystack);
739
741
  // Type assertions safe due to assertNeedleHaystack checks above
@@ -746,8 +748,8 @@ CompoundExpression.register(expressions, {
746
748
  [
747
749
  [ValueType, ValueType],
748
750
  (ctx, [needleExpr, haystackExpr]) => {
749
- const needle = needleExpr.evaluate(ctx) as Value;
750
- const haystack = haystackExpr.evaluate(ctx) as Value;
751
+ const needle = needleExpr!.evaluate(ctx) as Value;
752
+ const haystack = haystackExpr!.evaluate(ctx) as Value;
751
753
  assertNeedleHaystack(needle, haystack);
752
754
  // Type assertions safe due to assertNeedleHaystack checks above
753
755
  return (haystack as string | unknown[]).indexOf(needle as string);
@@ -755,9 +757,9 @@ CompoundExpression.register(expressions, {
755
757
  ], [
756
758
  [ValueType, ValueType, NumberType],
757
759
  (ctx, [needleExpr, haystackExpr, fromIndexExpr]) => {
758
- const needle = needleExpr.evaluate(ctx) as Value;
759
- const haystack = haystackExpr.evaluate(ctx) as Value;
760
- const fromIndex = fromIndexExpr.evaluate(ctx) as number;
760
+ const needle = needleExpr!.evaluate(ctx) as Value;
761
+ const haystack = haystackExpr!.evaluate(ctx) as Value;
762
+ const fromIndex = fromIndexExpr!.evaluate(ctx) as number;
761
763
  assertNeedleHaystack(needle, haystack);
762
764
  // Type assertions safe due to assertNeedleHaystack checks above
763
765
  return (haystack as string | unknown[]).indexOf(needle as string, fromIndex);
@@ -769,7 +771,7 @@ CompoundExpression.register(expressions, {
769
771
  StringType,
770
772
  [CollatorType],
771
773
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
772
- (ctx, [collator]) => collator.evaluate(ctx).resolvedLocale()
774
+ (ctx, [collator]) => collator!.evaluate(ctx).resolvedLocale()
773
775
  ],
774
776
  'random': [
775
777
  NumberType,