@mapbox/mapbox-gl-style-spec 14.15.0-beta.2 → 14.16.0-beta.1

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 (76) hide show
  1. package/deref.ts +3 -0
  2. package/diff.ts +63 -0
  3. package/dist/index.cjs +741 -54
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +205 -40
  6. package/dist/index.es.js +741 -54
  7. package/dist/index.es.js.map +1 -1
  8. package/expression/compound_expression.ts +4 -0
  9. package/expression/definitions/assertion.ts +7 -0
  10. package/expression/definitions/case.ts +2 -1
  11. package/expression/definitions/coalesce.ts +4 -0
  12. package/expression/definitions/coercion.ts +12 -0
  13. package/expression/definitions/collator.ts +8 -5
  14. package/expression/definitions/comparison.ts +12 -5
  15. package/expression/definitions/config.ts +12 -0
  16. package/expression/definitions/distance.ts +13 -2
  17. package/expression/definitions/format.ts +10 -0
  18. package/expression/definitions/image.ts +3 -0
  19. package/expression/definitions/in.ts +5 -0
  20. package/expression/definitions/index.ts +62 -10
  21. package/expression/definitions/index_of.ts +6 -0
  22. package/expression/definitions/interpolate.ts +5 -1
  23. package/expression/definitions/length.ts +2 -0
  24. package/expression/definitions/let.ts +1 -0
  25. package/expression/definitions/match.ts +5 -0
  26. package/expression/definitions/number_format.ts +7 -0
  27. package/expression/definitions/slice.ts +4 -0
  28. package/expression/definitions/within.ts +1 -0
  29. package/expression/index.ts +28 -19
  30. package/expression/parsing_context.ts +2 -0
  31. package/expression/types/image_variant.ts +3 -0
  32. package/expression/types.ts +1 -2
  33. package/expression/values.ts +1 -0
  34. package/feature_filter/convert.ts +9 -1
  35. package/feature_filter/index.ts +41 -1
  36. package/format.ts +5 -0
  37. package/function/convert.ts +5 -0
  38. package/function/index.ts +79 -25
  39. package/group_by_layout.ts +4 -5
  40. package/migrate/v8.ts +42 -3
  41. package/migrate/v9.ts +5 -0
  42. package/migrate.ts +1 -0
  43. package/package.json +1 -1
  44. package/read_style.ts +2 -0
  45. package/reference/v8.json +463 -18
  46. package/rollup.config.js +1 -0
  47. package/style-spec.ts +187 -74
  48. package/test.js +4 -0
  49. package/types.ts +74 -5
  50. package/util/geometry_util.ts +4 -0
  51. package/validate/validate.ts +3 -8
  52. package/validate/validate_appearance.ts +101 -0
  53. package/validate/validate_array.ts +6 -4
  54. package/validate/validate_enum.ts +2 -7
  55. package/validate/validate_expression.ts +48 -3
  56. package/validate/validate_filter.ts +5 -3
  57. package/validate/validate_fog.ts +6 -0
  58. package/validate/validate_function.ts +2 -0
  59. package/validate/validate_iconset.ts +1 -0
  60. package/validate/validate_import.ts +2 -2
  61. package/validate/validate_layer.ts +37 -4
  62. package/validate/validate_light.ts +6 -0
  63. package/validate/validate_lights.ts +9 -0
  64. package/validate/validate_model.ts +1 -2
  65. package/validate/validate_number.ts +4 -4
  66. package/validate/validate_object.ts +7 -0
  67. package/validate/validate_projection.ts +2 -0
  68. package/validate/validate_property.ts +15 -4
  69. package/validate/validate_rain.ts +5 -0
  70. package/validate/validate_snow.ts +5 -0
  71. package/validate/validate_source.ts +13 -3
  72. package/validate/validate_style.ts +1 -0
  73. package/validate/validate_terrain.ts +6 -0
  74. package/validate_mapbox_api_supported.ts +1 -0
  75. package/visit.ts +2 -0
  76. package/util/extend.ts +0 -9
@@ -93,11 +93,13 @@ class CompoundExpression implements Expression {
93
93
  let argParseFailed = false;
94
94
  for (let i = 1; i < args.length; i++) {
95
95
  const arg = args[i];
96
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
96
97
  const expectedType = Array.isArray(params) ?
97
98
  params[i - 1] :
98
99
  // @ts-expect-error - TS2339 - Property 'type' does not exist on type 'Varargs | Evaluate'.
99
100
  params.type;
100
101
 
102
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
101
103
  const parsed = signatureContext.parse(arg, 1 + parsedArgs.length, expectedType);
102
104
  if (!parsed) {
103
105
  argParseFailed = true;
@@ -120,8 +122,10 @@ class CompoundExpression implements Expression {
120
122
 
121
123
  for (let i = 0; i < parsedArgs.length; i++) {
122
124
  // @ts-expect-error - TS2339 - Property 'type' does not exist on type 'Varargs | Evaluate'.
125
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
123
126
  const expected = Array.isArray(params) ? params[i] : params.type;
124
127
  const arg = parsedArgs[i];
128
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
125
129
  signatureContext.concat(i + 1).checkSubtype(expected, arg.type);
126
130
  }
127
131
 
@@ -47,6 +47,7 @@ class Assertion implements Expression {
47
47
  const type = args[1];
48
48
  if (typeof type !== 'string' || !(type in types) || type === 'object')
49
49
  return context.error('The item type argument of "array" must be one of string, number, boolean', 1);
50
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
50
51
  itemType = types[type];
51
52
  i++;
52
53
  } else {
@@ -66,9 +67,11 @@ class Assertion implements Expression {
66
67
  i++;
67
68
  }
68
69
 
70
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
69
71
  type = array(itemType, N);
70
72
  } else {
71
73
  assert(types[name], name);
74
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
72
75
  type = types[name];
73
76
  }
74
77
 
@@ -79,17 +82,21 @@ class Assertion implements Expression {
79
82
  parsed.push(input);
80
83
  }
81
84
 
85
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
82
86
  return new Assertion(type, parsed);
83
87
  }
84
88
 
85
89
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
86
90
  evaluate(ctx: EvaluationContext): any {
87
91
  for (let i = 0; i < this.args.length; i++) {
92
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
88
93
  const value = this.args[i].evaluate(ctx);
94
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
89
95
  const error = checkSubtype(this.type, typeOf(value));
90
96
  if (!error) {
91
97
  return value;
92
98
  } else if (i === this.args.length - 1) {
99
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
93
100
  throw new RuntimeError(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${toString(typeOf(value))} but was expected to be of type ${toString(this.type)}.`);
94
101
  }
95
102
  }
@@ -50,6 +50,7 @@ class Case implements Expression {
50
50
  if (!otherwise) return null;
51
51
 
52
52
  assert(outputType);
53
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
53
54
  return new Case(outputType, branches, otherwise);
54
55
  }
55
56
 
@@ -72,7 +73,7 @@ class Case implements Expression {
72
73
  }
73
74
 
74
75
  outputDefined(): boolean {
75
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
76
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
76
77
  return this.branches.every(([_, out]: [any, any]) => out.outputDefined()) && this.otherwise.outputDefined();
77
78
  }
78
79
 
@@ -42,10 +42,13 @@ class Coalesce implements Expression {
42
42
  // Thus, if any of our arguments would have needed an annotation, we
43
43
  // need to wrap the enclosing coalesce expression with it instead.
44
44
  const needsAnnotation = expectedType &&
45
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
45
46
  parsedArgs.some(arg => checkSubtype(expectedType, arg.type));
46
47
 
47
48
  return needsAnnotation ?
49
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
48
50
  new Coalesce(ValueType, parsedArgs) :
51
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
49
52
  new Coalesce(outputType, parsedArgs);
50
53
  }
51
54
 
@@ -56,6 +59,7 @@ class Coalesce implements Expression {
56
59
  let firstImage;
57
60
  for (const arg of this.args) {
58
61
  argCount++;
62
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
59
63
  result = arg.evaluate(ctx);
60
64
  // we need to keep track of the first requested image in a coalesce statement
61
65
  // if coalesce can't find a valid image, we return the first image so styleimagemissing can fire
@@ -55,12 +55,15 @@ class Coercion implements Expression {
55
55
  return context.error(`Expected ${context.expectedType.kind} but found array.`);
56
56
  }
57
57
  } else if (arrayLength > 0 && isValue(args[1][0])) {
58
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
58
59
  const value = (args[1][0]);
60
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
59
61
  type = array(typeOf(value), arrayLength);
60
62
  } else {
61
63
  return null;
62
64
  }
63
65
  for (let i = 0; i < arrayLength; i++) {
66
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
64
67
  const member = args[1][i];
65
68
  let parsedMember;
66
69
  if (Array.isArray(member)) {
@@ -81,6 +84,7 @@ class Coercion implements Expression {
81
84
  if ((name === 'to-boolean' || name === 'to-string') && args.length !== 2)
82
85
  return context.error(`Expected one argument.`);
83
86
 
87
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
84
88
  type = types[name];
85
89
 
86
90
  for (let i = 1; i < args.length; i++) {
@@ -90,6 +94,7 @@ class Coercion implements Expression {
90
94
  }
91
95
  }
92
96
 
97
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
93
98
  return new Coercion(type, parsed);
94
99
  }
95
100
 
@@ -101,6 +106,7 @@ class Coercion implements Expression {
101
106
  let input;
102
107
  let error;
103
108
  for (const arg of this.args) {
109
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
104
110
  input = arg.evaluate(ctx);
105
111
  error = null;
106
112
  if (input instanceof Color) {
@@ -115,14 +121,17 @@ class Coercion implements Expression {
115
121
  error = validateRGBA(input[0], input[1], input[2], input[3]);
116
122
  }
117
123
  if (!error) {
124
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
118
125
  return new Color((input[0]) / 255, (input[1]) / 255, (input[2]) / 255, (input[3]));
119
126
  }
120
127
  }
121
128
  }
129
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
122
130
  throw new RuntimeError(error || `Could not parse color from value '${typeof input === 'string' ? input : String(JSON.stringify(input))}'`);
123
131
  } else if (this.type.kind === 'number') {
124
132
  let value = null;
125
133
  for (const arg of this.args) {
134
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
126
135
  value = arg.evaluate(ctx);
127
136
  if (value === null) return 0;
128
137
  const num = Number(value);
@@ -133,13 +142,16 @@ class Coercion implements Expression {
133
142
  } else if (this.type.kind === 'formatted') {
134
143
  // There is no explicit 'to-formatted' but this coercion can be implicitly
135
144
  // created by properties that expect the 'formatted' type.
145
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
136
146
  return Formatted.fromString(valueToString(this.args[0].evaluate(ctx)));
137
147
  } else if (this.type.kind === 'resolvedImage') {
148
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
138
149
  return ResolvedImage.build(valueToString(this.args[0].evaluate(ctx)));
139
150
  } else if (this.type.kind === 'array') {
140
151
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
141
152
  return this.args.map(arg => { return arg.evaluate(ctx); });
142
153
  } else {
154
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
143
155
  return valueToString(this.args[0].evaluate(ctx));
144
156
  }
145
157
  }
@@ -39,9 +39,9 @@ export default class CollatorExpression implements Expression {
39
39
  context.parseObjectValue(options['diacritic-sensitive'], 1, 'diacritic-sensitive', BooleanType);
40
40
  if (!diacriticSensitive) return null;
41
41
 
42
- let locale = null;
42
+ let locale: Expression = null;
43
43
  if (options['locale']) {
44
- locale = context.parseObjectValue(options['locale'], 1, 'locale', StringType);
44
+ locale = context.parseObjectValue(options['locale'], 1, 'locale', StringType) as Expression;
45
45
  if (!locale) return null;
46
46
  }
47
47
 
@@ -49,7 +49,11 @@ export default class CollatorExpression implements Expression {
49
49
  }
50
50
 
51
51
  evaluate(ctx: EvaluationContext): Collator {
52
- return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null);
52
+ return new Collator(
53
+ this.caseSensitive.evaluate(ctx) as boolean,
54
+ this.diacriticSensitive.evaluate(ctx) as boolean,
55
+ this.locale ? this.locale.evaluate(ctx) as string : null
56
+ );
53
57
  }
54
58
 
55
59
  eachChild(fn: (_: Expression) => void) {
@@ -69,8 +73,7 @@ export default class CollatorExpression implements Expression {
69
73
  }
70
74
 
71
75
  serialize(): SerializedExpression {
72
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
- const options: Record<string, any> = {};
76
+ const options: Record<string, SerializedExpression> = {};
74
77
  options['case-sensitive'] = this.caseSensitive.serialize();
75
78
  options['diacritic-sensitive'] = this.diacriticSensitive.serialize();
76
79
  if (this.locale) {
@@ -39,17 +39,17 @@ function lteq(ctx: EvaluationContext, a: any, b: any): boolean { return a <= b;
39
39
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
40
  function gteq(ctx: EvaluationContext, a: any, b: any): boolean { return a >= b; }
41
41
 
42
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
43
43
  function eqCollate(ctx: EvaluationContext, a: any, b: any, c: any): boolean { return c.compare(a, b) === 0; }
44
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
45
  function neqCollate(ctx: EvaluationContext, a: any, b: any, c: any): boolean { return !eqCollate(ctx, a, b, c); }
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
47
47
  function ltCollate(ctx: EvaluationContext, a: any, b: any, c: any): boolean { return c.compare(a, b) < 0; }
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
49
49
  function gtCollate(ctx: EvaluationContext, a: any, b: any, c: any): boolean { return c.compare(a, b) > 0; }
50
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
51
51
  function lteqCollate(ctx: EvaluationContext, a: any, b: any, c: any): boolean { return c.compare(a, b) <= 0; }
52
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
52
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
53
53
  function gteqCollate(ctx: EvaluationContext, a: any, b: any, c: any): boolean { return c.compare(a, b) >= 0; }
54
54
 
55
55
  /**
@@ -143,15 +143,20 @@ function makeComparison(
143
143
  if (!collator) return null;
144
144
  }
145
145
 
146
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
146
147
  return new Comparison(lhs, rhs, collator);
147
148
  }
148
149
 
149
150
  evaluate(ctx: EvaluationContext): boolean {
151
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
150
152
  const lhs = this.lhs.evaluate(ctx);
153
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
151
154
  const rhs = this.rhs.evaluate(ctx);
152
155
 
153
156
  if (isOrderComparison && this.hasUntypedArgument) {
157
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
154
158
  const lt = typeOf(lhs);
159
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
155
160
  const rt = typeOf(rhs);
156
161
  // check that type is string or number, and equal
157
162
  if (lt.kind !== rt.kind || !(lt.kind === 'string' || lt.kind === 'number')) {
@@ -160,7 +165,9 @@ function makeComparison(
160
165
  }
161
166
 
162
167
  if (this.collator && !isOrderComparison && this.hasUntypedArgument) {
168
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
163
169
  const lt = typeOf(lhs);
170
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
164
171
  const rt = typeOf(rhs);
165
172
  if (lt.kind !== 'string' || rt.kind !== 'string') {
166
173
  return compareBasic(ctx, lhs, rhs);
@@ -19,14 +19,18 @@ export function makeConfigFQID(id: string, ownScope?: string | null, contextScop
19
19
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
20
  function coerceValue(type: string, value: any): any {
21
21
  switch (type) {
22
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
22
23
  case 'string': return valueToString(value);
23
24
  case 'number': return +value;
24
25
  case 'boolean': return !!value;
26
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
25
27
  case 'color': return Color.parse(value);
26
28
  case 'formatted': {
29
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
27
30
  return Formatted.fromString(valueToString(value));
28
31
  }
29
32
  case 'resolvedImage': {
33
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
30
34
  return ResolvedImage.build(valueToString(value));
31
35
  }
32
36
  }
@@ -105,17 +109,21 @@ class Config implements Expression {
105
109
 
106
110
  const {type, value, values, minValue, maxValue, stepValue} = config;
107
111
 
112
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
108
113
  const defaultValue = config.default.evaluate(ctx);
109
114
 
115
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
110
116
  let result = defaultValue;
111
117
  if (value) {
112
118
  // temporarily override scope to parent to evaluate config expressions passed from the parent
113
119
  const originalScope = ctx.scope;
114
120
  ctx.scope = (originalScope || '').split(FQIDSeparator).slice(1).join(FQIDSeparator);
121
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
115
122
  result = value.evaluate(ctx);
116
123
  ctx.scope = originalScope;
117
124
  }
118
125
  if (type) {
126
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
119
127
  result = coerceValue(type, result);
120
128
  }
121
129
 
@@ -130,14 +138,18 @@ class Config implements Expression {
130
138
 
131
139
  if (value !== undefined && result !== undefined && values && !values.includes(result)) {
132
140
  // The result is not among the allowed values. Instead, use the default value from the option.
141
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
133
142
  result = defaultValue;
134
143
  if (type) {
144
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
135
145
  result = coerceValue(type, result);
136
146
  }
137
147
  }
138
148
 
139
149
  // @ts-expect-error - TS2367 - This comparison appears to be unintentional because the types 'string' and 'Type' have no overlap.
150
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
140
151
  if ((type && type !== this.type) || (result !== undefined && !typeEquals(typeOf(result), this.type))) {
152
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
141
153
  result = coerceValue(this.type.kind, result);
142
154
  }
143
155
 
@@ -275,8 +275,7 @@ function polygonToPolygonDistance(polygon1: Array<Array<[number, number]>>, poly
275
275
  return dist;
276
276
  }
277
277
 
278
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
279
- function updateQueue(distQueue: any, miniDist: number, ruler: CheapRuler, pointSet1: Array<[number, number]>, pointSet2: Array<[number, number]>, r1: IndexRange | null, r2: IndexRange | null) {
278
+ function updateQueue(distQueue: TinyQueue<DistPair>, miniDist: number, ruler: CheapRuler, pointSet1: Array<[number, number]>, pointSet2: Array<[number, number]>, r1: IndexRange | null, r2: IndexRange | null) {
280
279
  if (r1 === null || r2 === null) return;
281
280
  const tempDist = bboxToBBoxDistance(getBBox(pointSet1, r1), getBBox(pointSet2, r2), ruler);
282
281
  // Insert new pair to the queue if the bbox distance is less than miniDist, the pair with biggest distance will be at the top
@@ -416,16 +415,20 @@ function pointsToGeometryDistance(originGeometry: Array<Array<Point>>, canonical
416
415
  lngLatPoints.push(getLngLatPoint(point, canonical));
417
416
  }
418
417
  }
418
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
419
419
  const ruler = new CheapRuler(lngLatPoints[0][1], 'meters');
420
420
  if (geometry.type === 'Point' || geometry.type === 'MultiPoint' || geometry.type === 'LineString') {
421
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
421
422
  return pointSetsDistance(lngLatPoints, false /*isLine*/,
422
423
  (geometry.type === 'Point' ? [geometry.coordinates] : geometry.coordinates) as Array<[number, number]>,
423
424
  geometry.type === 'LineString' /*isLine*/, ruler);
424
425
  }
425
426
  if (geometry.type === 'MultiLineString') {
427
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
426
428
  return pointSetToLinesDistance(lngLatPoints, false /*isLine*/, geometry.coordinates as Array<Array<[number, number]>>, ruler);
427
429
  }
428
430
  if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {
431
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
429
432
  return pointSetToPolygonsDistance(lngLatPoints, false /*isLine*/,
430
433
  (geometry.type === 'Polygon' ? [geometry.coordinates] : geometry.coordinates) as Array<Array<Array<[number, number]>>>, ruler);
431
434
  }
@@ -441,15 +444,18 @@ function linesToGeometryDistance(originGeometry: Array<Array<Point>>, canonical:
441
444
  }
442
445
  lngLatLines.push(lngLatLine);
443
446
  }
447
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
444
448
  const ruler = new CheapRuler(lngLatLines[0][0][1], 'meters');
445
449
  if (geometry.type === 'Point' || geometry.type === 'MultiPoint' || geometry.type === 'LineString') {
446
450
  return pointSetToLinesDistance(
447
451
  (geometry.type === 'Point' ? [geometry.coordinates] : geometry.coordinates) as Array<[number, number]>,
452
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
448
453
  geometry.type === 'LineString' /*isLine*/, lngLatLines, ruler);
449
454
  }
450
455
  if (geometry.type === 'MultiLineString') {
451
456
  let dist = Infinity;
452
457
  for (let i = 0; i < geometry.coordinates.length; i++) {
458
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
453
459
  const tempDist = pointSetToLinesDistance(geometry.coordinates[i] as Array<[number, number]>, true /*isLine*/, lngLatLines, ruler, dist);
454
460
  if (isNaN(tempDist)) return tempDist;
455
461
  if ((dist = Math.min(dist, tempDist)) === 0.0) return dist;
@@ -459,6 +465,7 @@ function linesToGeometryDistance(originGeometry: Array<Array<Point>>, canonical:
459
465
  if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {
460
466
  let dist = Infinity;
461
467
  for (let i = 0; i < lngLatLines.length; i++) {
468
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
462
469
  const tempDist = pointSetToPolygonsDistance(lngLatLines[i], true /*isLine*/,
463
470
  (geometry.type === 'Polygon' ? [geometry.coordinates] : geometry.coordinates) as Array<Array<Array<[number, number]>>>,
464
471
  ruler, dist);
@@ -479,15 +486,18 @@ function polygonsToGeometryDistance(originGeometry: Array<Array<Point>>, canonic
479
486
  }
480
487
  lngLatPolygons.push(lngLatPolygon);
481
488
  }
489
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
482
490
  const ruler = new CheapRuler(lngLatPolygons[0][0][0][1], 'meters');
483
491
  if (geometry.type === 'Point' || geometry.type === 'MultiPoint' || geometry.type === 'LineString') {
484
492
  return pointSetToPolygonsDistance(
485
493
  (geometry.type === 'Point' ? [geometry.coordinates] : geometry.coordinates) as Array<[number, number]>,
494
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
486
495
  geometry.type === 'LineString' /*isLine*/, lngLatPolygons, ruler);
487
496
  }
488
497
  if (geometry.type === 'MultiLineString') {
489
498
  let dist = Infinity;
490
499
  for (let i = 0; i < geometry.coordinates.length; i++) {
500
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
491
501
  const tempDist = pointSetToPolygonsDistance(geometry.coordinates[i] as Array<[number, number]>, true /*isLine*/, lngLatPolygons, ruler, dist);
492
502
  if (isNaN(tempDist)) return tempDist;
493
503
  if ((dist = Math.min(dist, tempDist)) === 0.0) return dist;
@@ -497,6 +507,7 @@ function polygonsToGeometryDistance(originGeometry: Array<Array<Point>>, canonic
497
507
  if (geometry.type === 'Polygon' || geometry.type === 'MultiPolygon') {
498
508
  return polygonsToPolygonsDistance(
499
509
  (geometry.type === 'Polygon' ? [geometry.coordinates] : geometry.coordinates) as Array<Array<Array<[number, number]>>>,
510
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
500
511
  lngLatPolygons, ruler);
501
512
  }
502
513
  return null;
@@ -71,8 +71,11 @@ export default class FormatExpression implements Expression {
71
71
  }
72
72
 
73
73
  const lastExpression = sections[sections.length - 1];
74
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
74
75
  lastExpression.scale = scale;
76
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
75
77
  lastExpression.font = font;
78
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
76
79
  lastExpression.textColor = textColor;
77
80
  } else {
78
81
  const content = context.parse(args[i], i, ValueType);
@@ -92,16 +95,23 @@ export default class FormatExpression implements Expression {
92
95
 
93
96
  evaluate(ctx: EvaluationContext): Formatted {
94
97
  const evaluateSection = (section: FormattedSectionExpression) => {
98
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
95
99
  const evaluatedContent = section.content.evaluate(ctx);
100
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
96
101
  if (typeEquals(typeOf(evaluatedContent), ResolvedImageType)) {
102
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
97
103
  return new FormattedSection('', evaluatedContent, null, null, null);
98
104
  }
99
105
 
100
106
  return new FormattedSection(
107
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
101
108
  toString(evaluatedContent),
102
109
  null,
110
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
103
111
  section.scale ? section.scale.evaluate(ctx) : null,
112
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
104
113
  section.font ? section.font.evaluate(ctx).join(',') : null,
114
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
105
115
  section.textColor ? section.textColor.evaluate(ctx) : null
106
116
  );
107
117
  };
@@ -167,6 +167,7 @@ export default class ImageExpression implements Expression {
167
167
  for (const key in params) {
168
168
  if (params[key]) {
169
169
  try {
170
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
170
171
  result[key] = params[key].evaluate(ctx);
171
172
  } catch (err) {
172
173
  continue;
@@ -186,11 +187,13 @@ export default class ImageExpression implements Expression {
186
187
 
187
188
  evaluate(ctx: EvaluationContext): null | ResolvedImage {
188
189
  const primaryId = {
190
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
189
191
  name: this.namePrimary.evaluate(ctx),
190
192
  iconsetId: this.iconsetIdPrimary
191
193
  };
192
194
 
193
195
  const secondaryId = this.nameSecondary ? {
196
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
194
197
  name: this.nameSecondary.evaluate(ctx),
195
198
  iconsetId: this.iconsetIdSecondary
196
199
  } : undefined;
@@ -48,19 +48,24 @@ class In implements Expression {
48
48
  }
49
49
 
50
50
  evaluate(ctx: EvaluationContext): boolean {
51
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
51
52
  const needle = (this.needle.evaluate(ctx));
53
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
52
54
  const haystack = (this.haystack.evaluate(ctx));
53
55
 
54
56
  if (haystack == null) return false;
55
57
 
56
58
  if (!isValidNativeType(needle, ['boolean', 'string', 'number', 'null'])) {
59
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
57
60
  throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString(typeOf(needle))} instead.`);
58
61
  }
59
62
 
60
63
  if (!isValidNativeType(haystack, ['string', 'array'])) {
64
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
61
65
  throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString(typeOf(haystack))} instead.`);
62
66
  }
63
67
 
68
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
64
69
  return haystack.indexOf(needle) >= 0;
65
70
  }
66
71