@mapbox/mapbox-gl-style-spec 14.12.0-beta.1 → 14.13.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 (81) hide show
  1. package/composite.ts +2 -0
  2. package/deref.ts +5 -5
  3. package/diff.ts +21 -21
  4. package/dist/index.cjs +455 -241
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.ts +64 -30
  7. package/dist/index.es.js +455 -241
  8. package/dist/index.es.js.map +1 -1
  9. package/error/validation_error.ts +1 -3
  10. package/expression/definitions/assertion.ts +2 -1
  11. package/expression/definitions/at.ts +1 -1
  12. package/expression/definitions/at_interpolated.ts +1 -1
  13. package/expression/definitions/case.ts +3 -1
  14. package/expression/definitions/coalesce.ts +1 -0
  15. package/expression/definitions/coercion.ts +3 -1
  16. package/expression/definitions/collator.ts +2 -1
  17. package/expression/definitions/comparison.ts +15 -1
  18. package/expression/definitions/config.ts +33 -10
  19. package/expression/definitions/distance.ts +6 -4
  20. package/expression/definitions/format.ts +3 -2
  21. package/expression/definitions/index.ts +29 -3
  22. package/expression/definitions/index_of.ts +1 -0
  23. package/expression/definitions/interpolate.ts +5 -1
  24. package/expression/definitions/let.ts +1 -0
  25. package/expression/definitions/literal.ts +3 -3
  26. package/expression/definitions/match.ts +5 -3
  27. package/expression/definitions/number_format.ts +3 -4
  28. package/expression/definitions/slice.ts +1 -0
  29. package/expression/definitions/step.ts +1 -0
  30. package/expression/definitions/var.ts +1 -0
  31. package/expression/definitions/within.ts +6 -2
  32. package/expression/expression.ts +3 -0
  33. package/expression/index.ts +18 -3
  34. package/expression/is_constant.ts +4 -0
  35. package/expression/parsing_context.ts +1 -1
  36. package/expression/types/formatted.ts +1 -1
  37. package/expression/types/image_variant.ts +2 -2
  38. package/expression/types.ts +9 -0
  39. package/expression/values.ts +1 -3
  40. package/feature_filter/convert.ts +13 -6
  41. package/feature_filter/index.ts +16 -0
  42. package/format.ts +1 -0
  43. package/function/convert.ts +5 -1
  44. package/function/index.ts +28 -0
  45. package/group_by_layout.ts +17 -8
  46. package/migrate/expressions.ts +2 -2
  47. package/migrate/v8.ts +9 -0
  48. package/migrate/v9.ts +1 -0
  49. package/migrate.ts +1 -0
  50. package/package.json +1 -1
  51. package/read_style.ts +1 -0
  52. package/reference/latest.ts +1 -0
  53. package/reference/v8.json +209 -21
  54. package/types.ts +21 -2
  55. package/union-to-intersection.ts +1 -1
  56. package/util/color.ts +85 -69
  57. package/util/extend.ts +1 -0
  58. package/util/geometry_util.ts +7 -8
  59. package/util/interpolate.ts +0 -4
  60. package/validate/validate.ts +6 -0
  61. package/validate/validate_array.ts +2 -0
  62. package/validate/validate_enum.ts +1 -0
  63. package/validate/validate_expression.ts +4 -0
  64. package/validate/validate_filter.ts +4 -2
  65. package/validate/validate_fog.ts +3 -0
  66. package/validate/validate_function.ts +7 -2
  67. package/validate/validate_iconset.ts +1 -0
  68. package/validate/validate_layer.ts +1 -0
  69. package/validate/validate_light.ts +3 -0
  70. package/validate/validate_lights.ts +27 -21
  71. package/validate/validate_model.ts +4 -0
  72. package/validate/validate_object.ts +2 -2
  73. package/validate/validate_projection.ts +1 -0
  74. package/validate/validate_property.ts +4 -0
  75. package/validate/validate_rain.ts +3 -0
  76. package/validate/validate_snow.ts +3 -0
  77. package/validate/validate_source.ts +8 -6
  78. package/validate/validate_terrain.ts +4 -0
  79. package/validate_mapbox_api_supported.ts +30 -19
  80. package/validate_style.ts +1 -0
  81. package/visit.ts +3 -1
@@ -15,12 +15,14 @@ export default function validateLights(options: Options): Array<ValidationError>
15
15
  let errors = [];
16
16
 
17
17
  if (!light) {
18
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18
19
  return errors;
19
20
  }
20
21
 
21
22
  const type = getType(light);
22
23
  if (type !== 'object') {
23
24
  errors = errors.concat([new ValidationError('light-3d', light, `object expected, ${type} found`)]);
25
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
24
26
  return errors;
25
27
  }
26
28
 
@@ -33,6 +35,7 @@ export default function validateLights(options: Options): Array<ValidationError>
33
35
  for (const key of ['type', 'id']) {
34
36
  if (!(key in light)) {
35
37
  errors = errors.concat([new ValidationError('light-3d', light, `missing property ${key} on light`)]);
38
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
36
39
  return errors;
37
40
  }
38
41
  }
@@ -51,6 +54,7 @@ export default function validateLights(options: Options): Array<ValidationError>
51
54
  const lightType = `properties_light_${light['type']}`;
52
55
  if (!(lightType in styleSpec)) {
53
56
  errors = errors.concat([new ValidationError('light-3d', light, `Invalid light type ${light['type']}`)]);
57
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
54
58
  return errors;
55
59
  }
56
60
 
@@ -62,10 +66,30 @@ export default function validateLights(options: Options): Array<ValidationError>
62
66
  const propertiesType = getType(properties);
63
67
  if (propertiesType !== 'object') {
64
68
  errors = errors.concat([new ValidationError('properties', properties, `object expected, ${propertiesType} found`)]);
69
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
65
70
  return errors;
66
71
  }
67
72
  for (const propertyKey in properties) {
68
- if (!lightPropertySpec[propertyKey]) {
73
+ const transitionMatch = propertyKey.match(/^(.*)-transition$/);
74
+ const useThemeMatch = propertyKey.match(/^(.*)-use-theme$/);
75
+
76
+ if (useThemeMatch && lightPropertySpec[useThemeMatch[1]]) {
77
+ errors = errors.concat(validate({
78
+ key,
79
+ value: properties[propertyKey],
80
+ valueSpec: {type: 'string'},
81
+ style,
82
+ styleSpec
83
+ }));
84
+ } else if (transitionMatch && lightPropertySpec[transitionMatch[1]] && lightPropertySpec[transitionMatch[1]].transition) {
85
+ errors = errors.concat(validate({
86
+ key,
87
+ value: light[key],
88
+ valueSpec: styleSpec.transition,
89
+ style,
90
+ styleSpec
91
+ }));
92
+ } else if (!lightPropertySpec[propertyKey]) {
69
93
  errors = errors.concat([new ValidationWarning(options.key, properties[propertyKey], `unknown property "${propertyKey}"`)]);
70
94
  } else {
71
95
  errors = errors.concat(validate({
@@ -78,26 +102,7 @@ export default function validateLights(options: Options): Array<ValidationError>
78
102
  }
79
103
  }
80
104
  } else {
81
- const transitionMatch = key.match(/^(.*)-transition$/);
82
- const useThemeMatch = key.match(/^(.*)-use-theme$/);
83
-
84
- if (useThemeMatch && lightSpec[useThemeMatch[1]]) {
85
- errors = errors.concat(validate({
86
- key,
87
- value: light[key],
88
- valueSpec: {type: 'string'},
89
- style,
90
- styleSpec
91
- }));
92
- } else if (transitionMatch && lightSpec[transitionMatch[1]] && lightSpec[transitionMatch[1]].transition) {
93
- errors = errors.concat(validate({
94
- key,
95
- value: light[key],
96
- valueSpec: styleSpec.transition,
97
- style,
98
- styleSpec
99
- }));
100
- } else if (lightSpec[key]) {
105
+ if (lightSpec[key]) {
101
106
  errors = errors.concat(validate({
102
107
  key,
103
108
  value: light[key],
@@ -111,5 +116,6 @@ export default function validateLights(options: Options): Array<ValidationError>
111
116
  }
112
117
  }
113
118
 
119
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
114
120
  return errors;
115
121
  }
@@ -9,6 +9,7 @@ export function isValidUrl(str: string, allowRelativeUrls: boolean): boolean {
9
9
  try {
10
10
  new URL(str, isRelative && allowRelativeUrls ? 'http://example.com' : undefined);
11
11
  return true;
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
13
  } catch (_: any) {
13
14
  return false;
14
15
  }
@@ -19,12 +20,14 @@ export default function validateModel(options: ValidationOptions): Array<Validat
19
20
  let errors = [];
20
21
 
21
22
  if (!url) {
23
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
22
24
  return errors;
23
25
  }
24
26
 
25
27
  const type = getType(url);
26
28
  if (type !== 'string') {
27
29
  errors = errors.concat([new ValidationError(options.key, url, `string expected, "${type}" found`)]);
30
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
28
31
  return errors;
29
32
  }
30
33
 
@@ -32,5 +35,6 @@ export default function validateModel(options: ValidationOptions): Array<Validat
32
35
  errors = errors.concat([new ValidationError(options.key, url, `invalid url "${url}"`)]);
33
36
  }
34
37
 
38
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
35
39
  return errors;
36
40
  }
@@ -7,7 +7,7 @@ import type {LayerSpecification} from '../types';
7
7
 
8
8
  type Options = ValidationOptions & {
9
9
  layer?: LayerSpecification;
10
- objectElementValidators?: any;
10
+ objectElementValidators?: object;
11
11
  };
12
12
 
13
13
  export default function validateObject(options: Options): Array<ValidationError> {
@@ -17,7 +17,7 @@ export default function validateObject(options: Options): Array<ValidationError>
17
17
  const elementValidators = options.objectElementValidators || {};
18
18
  const style = options.style;
19
19
  const styleSpec = options.styleSpec;
20
- let errors = [];
20
+ let errors: ValidationError[] = [];
21
21
 
22
22
  const type = getType(object);
23
23
  if (type !== 'object') {
@@ -28,5 +28,6 @@ export default function validateProjection(options: ValidationOptions): Array<Va
28
28
  errors = errors.concat([new ValidationError('projection', projection, `object or string expected, ${rootType} found`)]);
29
29
  }
30
30
 
31
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
31
32
  return errors;
32
33
  }
@@ -12,6 +12,7 @@ import type {ValidationOptions} from './validate';
12
12
  export type PropertyValidationOptions = ValidationOptions & {
13
13
  objectKey: string;
14
14
  layerType: string;
15
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
16
  layer: any;
16
17
  };
17
18
 
@@ -30,6 +31,7 @@ export default function validateProperty(options: PropertyValidationOptions, pro
30
31
  if (propertyType === 'paint' && useThemeMatch && layerSpec[useThemeMatch[1]]) {
31
32
  if (isExpression(value)) {
32
33
  const errors = [];
34
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
33
35
  return errors.concat(validate({
34
36
  key: options.key,
35
37
  value,
@@ -99,6 +101,7 @@ export default function validateProperty(options: PropertyValidationOptions, pro
99
101
  if (supportsPropertyExpression(valueSpec) && (supportsLightExpression(valueSpec) || supportsZoomExpression(valueSpec))) {
100
102
  // Performance related style spec limitation: zoom and light expressions are not allowed for e.g. trees.
101
103
  const expression = createPropertyExpression(deepUnbundle(value), valueSpec);
104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
105
  const expressionObj = (expression.value as any).expression || (expression.value as any)._styleExpression.expression;
103
106
 
104
107
  if (expressionObj && !isGlobalPropertyConstant(expressionObj, ['measure-light'])) {
@@ -109,6 +112,7 @@ export default function validateProperty(options: PropertyValidationOptions, pro
109
112
  }
110
113
  }
111
114
 
115
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
112
116
  return errors.concat(validate({
113
117
  key: options.key,
114
118
  value,
@@ -13,9 +13,11 @@ export default function validateRain(options: ValidationOptions): Array<Validati
13
13
 
14
14
  const rootType = getType(rain);
15
15
  if (rain === undefined) {
16
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
16
17
  return errors;
17
18
  } else if (rootType !== 'object') {
18
19
  errors = errors.concat([new ValidationError('rain', rain, `object expected, ${rootType} found`)]);
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
19
21
  return errors;
20
22
  }
21
23
 
@@ -43,5 +45,6 @@ export default function validateRain(options: ValidationOptions): Array<Validati
43
45
  }
44
46
  }
45
47
 
48
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
46
49
  return errors;
47
50
  }
@@ -13,9 +13,11 @@ export default function validateSnow(options: ValidationOptions): Array<Validati
13
13
 
14
14
  const rootType = getType(snow);
15
15
  if (snow === undefined) {
16
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
16
17
  return errors;
17
18
  } else if (rootType !== 'object') {
18
19
  errors = errors.concat([new ValidationError('snow', snow, `object expected, ${rootType} found`)]);
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
19
21
  return errors;
20
22
  }
21
23
 
@@ -43,5 +45,6 @@ export default function validateSnow(options: ValidationOptions): Array<Validati
43
45
  }
44
46
  }
45
47
 
48
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
46
49
  return errors;
47
50
  }
@@ -26,7 +26,7 @@ export default function validateSource(options: ValidationOptions): Array<Valida
26
26
  }
27
27
 
28
28
  const type = unbundle(value.type) as string;
29
- let errors = [];
29
+ let errors: ValidationError[] = [];
30
30
 
31
31
  if (['vector', 'raster', 'raster-dem', 'raster-array'].includes(type)) {
32
32
  if (!value.url && !value.tiles) {
@@ -48,7 +48,6 @@ export default function validateSource(options: ValidationOptions): Array<Valida
48
48
  objectElementValidators
49
49
  }));
50
50
  return errors;
51
-
52
51
  case 'geojson':
53
52
  errors = validateObject({
54
53
  key,
@@ -58,6 +57,7 @@ export default function validateSource(options: ValidationOptions): Array<Valida
58
57
  styleSpec,
59
58
  objectElementValidators
60
59
  });
60
+
61
61
  if (value.cluster) {
62
62
  for (const prop in value.clusterProperties) {
63
63
  const [operator, mapExpr] = value.clusterProperties[prop];
@@ -75,8 +75,8 @@ export default function validateSource(options: ValidationOptions): Array<Valida
75
75
  }));
76
76
  }
77
77
  }
78
- return errors;
79
78
 
79
+ return errors;
80
80
  case 'video':
81
81
  return validateObject({
82
82
  key,
@@ -110,7 +110,8 @@ export default function validateSource(options: ValidationOptions): Array<Valida
110
110
  }
111
111
 
112
112
  function getSourceTypeValues(styleSpec: StyleReference) {
113
- return styleSpec.source.reduce((memo, source) => {
113
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
114
+ return styleSpec.source.reduce((memo: string[], source: string) => {
114
115
  const sourceType = styleSpec[source];
115
116
  if (sourceType.type.type === 'enum') {
116
117
  memo = memo.concat(Object.keys(sourceType.type.values));
@@ -126,7 +127,7 @@ function validatePromoteId({
126
127
  if (getType(value) === 'string') {
127
128
  return validateString({key, value});
128
129
  } else if (Array.isArray(value)) {
129
- const errors = [];
130
+ const errors: ValidationError[] = [];
130
131
  const unbundledValue = deepUnbundle(value);
131
132
  const expression = createExpression(unbundledValue);
132
133
  if (expression.result === 'error') {
@@ -144,10 +145,11 @@ function validatePromoteId({
144
145
 
145
146
  return errors;
146
147
  } else {
147
- const errors = [];
148
+ const errors: ValidationError[] = [];
148
149
  for (const prop in value) {
149
150
  errors.push(...validatePromoteId({key: `${key}.${prop}`, value: value[prop]}));
150
151
  }
152
+
151
153
  return errors;
152
154
  }
153
155
  }
@@ -15,11 +15,14 @@ export default function validateTerrain(options: ValidationOptions): Array<Valid
15
15
 
16
16
  const rootType = getType(terrain);
17
17
  if (terrain === undefined) {
18
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
18
19
  return errors;
19
20
  } else if (rootType === 'null') {
21
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
20
22
  return errors;
21
23
  } else if (rootType !== 'object') {
22
24
  errors = errors.concat([new ValidationError('terrain', terrain, `object expected, ${rootType} found`)]);
25
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
23
26
  return errors;
24
27
  }
25
28
 
@@ -68,5 +71,6 @@ export default function validateTerrain(options: ValidationOptions): Array<Valid
68
71
  }
69
72
  }
70
73
 
74
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
71
75
  return errors;
72
76
  }
@@ -4,7 +4,19 @@ import readStyle from './read_style';
4
4
  import ValidationError from './error/validation_error';
5
5
  import getType from './util/get_type';
6
6
 
7
+ import type {StyleReference} from './reference/latest';
7
8
  import type {ValidationErrors} from './validate_style.min';
9
+ import type {
10
+ StyleSpecification,
11
+ SourceSpecification,
12
+ SourcesSpecification,
13
+ ImportSpecification
14
+ } from './types';
15
+
16
+ type MapboxStyleSpecification = StyleSpecification & {
17
+ visibility?: 'public' | 'private';
18
+ protected?: boolean;
19
+ };
8
20
 
9
21
  const SUPPORTED_SPEC_VERSION = 8;
10
22
  const MAX_SOURCES_IN_STYLE = 15;
@@ -14,17 +26,17 @@ function isValid(value: string | null | undefined, regex: RegExp): boolean {
14
26
  return !!value.match(regex);
15
27
  }
16
28
 
17
- function getSourceCount(source: any): number {
18
- if (source.url) {
29
+ function getSourceCount(source: SourceSpecification): number {
30
+ if ('url' in source) {
19
31
  return source.url.split(',').length;
20
32
  } else {
21
33
  return 0;
22
34
  }
23
35
  }
24
36
 
25
- function getAllowedKeyErrors(obj: any, keys: Array<any>, path?: string | null): Array<ValidationError> {
37
+ function getAllowedKeyErrors(obj: object, keys: string[], path?: string | null): Array<ValidationError> {
26
38
  const allowed = new Set(keys);
27
- const errors = [];
39
+ const errors: ValidationError[] = [];
28
40
  Object.keys(obj).forEach(k => {
29
41
  if (!allowed.has(k)) {
30
42
  const prop = path ? `${path}.${k}` : null;
@@ -34,9 +46,9 @@ function getAllowedKeyErrors(obj: any, keys: Array<any>, path?: string | null):
34
46
  return errors;
35
47
  }
36
48
 
37
- const acceptedSourceTypes = new Set(["vector", "raster", "raster-dem", "raster-array", "model", "batched-model"]);
38
- function getSourceErrors(source: any, i: number): Array<ValidationError> {
39
- const errors = [];
49
+ const acceptedSourceTypes = new Set<SourceSpecification['type']>(['vector', 'raster', 'raster-dem', 'raster-array', 'model', 'batched-model']);
50
+ function getSourceErrors(source: SourceSpecification, i: number): Array<ValidationError> {
51
+ const errors: ValidationError[] = [];
40
52
 
41
53
  /*
42
54
  * Inlined sources are not supported by the Mapbox Styles API, so only
@@ -48,7 +60,7 @@ function getSourceErrors(source: any, i: number): Array<ValidationError> {
48
60
  /*
49
61
  * "type" is required and must be one of "vector", "raster", "raster-dem", "raster-array"
50
62
  */
51
- if (!acceptedSourceTypes.has(String(source.type))) {
63
+ if (!acceptedSourceTypes.has(String(source.type) as SourceSpecification['type'])) {
52
64
  errors.push(new ValidationError(`sources[${i}].type`, source.type, `Expected one of [${Array.from(acceptedSourceTypes).join(", ")}]`));
53
65
  }
54
66
 
@@ -59,22 +71,22 @@ function getSourceErrors(source: any, i: number): Array<ValidationError> {
59
71
  * mapbox://mapbox.abcd1234,penny.abcd1234
60
72
  */
61
73
  const sourceUrlPattern = /^mapbox:\/\/([^/]*)$/;
62
- if (!source.url || !isValid(source.url, sourceUrlPattern)) {
63
- errors.push(new ValidationError(`sources[${i}].url`, source.url, 'Expected a valid Mapbox tileset url'));
74
+ if (!('url' in source) || !isValid(source.url, sourceUrlPattern)) {
75
+ errors.push(new ValidationError(`sources[${i}].url`, (source as {url?: string}).url, 'Expected a valid Mapbox tileset url'));
64
76
  }
65
77
 
66
78
  return errors;
67
79
  }
68
80
 
69
81
  function getMaxSourcesErrors(sourcesCount: number): Array<ValidationError> {
70
- const errors = [];
82
+ const errors: ValidationError[] = [];
71
83
  if (sourcesCount > MAX_SOURCES_IN_STYLE) {
72
84
  errors.push(new ValidationError('sources', null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer sources`));
73
85
  }
74
86
  return errors;
75
87
  }
76
88
 
77
- function getSourcesErrors(sources: any): {
89
+ function getSourcesErrors(sources: SourcesSpecification): {
78
90
  errors: Array<ValidationError>;
79
91
  sourcesCount: number;
80
92
  } {
@@ -95,14 +107,11 @@ function getSourcesErrors(sources: any): {
95
107
  return {errors, sourcesCount};
96
108
  }
97
109
 
98
- function getImportErrors(imports: Array<any> = []): {
99
- errors: Array<ValidationError>;
100
- sourcesCount: number;
101
- } {
110
+ function getImportErrors(imports: ImportSpecification[] = []): {errors: Array<ValidationError>; sourcesCount: number} {
102
111
  let errors: Array<ValidationError> = [];
103
112
 
104
113
  let sourcesCount = 0;
105
- const validateImports = (imports: Array<any> = []) => {
114
+ const validateImports = (imports: ImportSpecification[] = []) => {
106
115
  for (const importSpec of imports) {
107
116
  const style = importSpec.data;
108
117
  if (!style) continue;
@@ -129,7 +138,7 @@ function getImportErrors(imports: Array<any> = []): {
129
138
  return {errors, sourcesCount};
130
139
  }
131
140
 
132
- function getRootErrors(style: any, specKeys: Array<any>): Array<ValidationError> {
141
+ function getRootErrors(style: MapboxStyleSpecification, specKeys: string[]): Array<ValidationError> {
133
142
  const errors = [];
134
143
 
135
144
  /*
@@ -195,6 +204,7 @@ function getRootErrors(style: any, specKeys: Array<any>): Array<ValidationError>
195
204
  errors.push(new ValidationError('protected', style.protected, 'Style protection must be true or false'));
196
205
  }
197
206
 
207
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
198
208
  return errors;
199
209
  }
200
210
 
@@ -208,11 +218,12 @@ function getRootErrors(style: any, specKeys: Array<any>): Array<ValidationError>
208
218
  * var validateMapboxApiSupported = require('mapbox-gl-style-spec/lib/validate_style_mapbox_api_supported.js');
209
219
  * var errors = validateMapboxApiSupported(style);
210
220
  */
211
- export default function validateMapboxApiSupported(style: any, styleSpec: any = v8): ValidationErrors {
221
+ export default function validateMapboxApiSupported(style: MapboxStyleSpecification, styleSpec: StyleReference = v8): ValidationErrors {
212
222
  let s = style;
213
223
  try {
214
224
  s = readStyle(s);
215
225
  } catch (e) {
226
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
216
227
  return [e];
217
228
  }
218
229
 
package/validate_style.ts CHANGED
@@ -28,6 +28,7 @@ export default function validateStyle(style: StyleSpecification | string | Buffe
28
28
  try {
29
29
  s = readStyle(s);
30
30
  } catch (e) {
31
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
31
32
  return [e];
32
33
  }
33
34
 
package/visit.ts CHANGED
@@ -11,11 +11,13 @@ import type {
11
11
  function getPropertyReference(propertyName: string): StylePropertySpecification {
12
12
  for (let i = 0; i < Reference.layout.length; i++) {
13
13
  for (const key in Reference[Reference.layout[i]]) {
14
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
14
15
  if (key === propertyName) return Reference[Reference.layout[i]][key];
15
16
  }
16
17
  }
17
18
  for (let i = 0; i < Reference.paint.length; i++) {
18
19
  for (const key in Reference[Reference.paint[i]]) {
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
19
21
  if (key === propertyName) return Reference[Reference.paint[i]][key];
20
22
  }
21
23
  }
@@ -57,7 +59,7 @@ export function eachProperty(
57
59
  ) {
58
60
  function inner(layer: LayerSpecification, propertyType: 'paint' | 'layout') {
59
61
  if (layer.type === 'slot' || layer.type === 'clip') return;
60
- const properties = (layer[propertyType] as any);
62
+ const properties = layer[propertyType];
61
63
  if (!properties) return;
62
64
  Object.keys(properties).forEach((key) => {
63
65
  callback({