From befd6d1c69e2662110617700393f7d4bae43f9e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 26 Feb 2020 15:43:27 +0100 Subject: [PATCH] Add names before types for lambda types and object indexer types (#9331) --- build/generate-flow-typed-style-spec.js | 4 +-- flow-typed/vector-tile.js | 4 +-- src/data/bucket.js | 6 ++-- src/data/bucket/circle_bucket.js | 2 +- src/data/bucket/fill_bucket.js | 6 ++-- src/data/bucket/fill_extrusion_bucket.js | 6 ++-- src/data/bucket/line_bucket.js | 8 +++--- src/data/bucket/symbol_bucket.js | 6 ++-- src/data/feature_index.js | 12 ++++---- src/data/program_configuration.js | 28 +++++++++---------- src/data/segment.js | 2 +- src/geo/transform.js | 4 +-- src/render/draw_symbol.js | 2 +- src/render/glyph_atlas.js | 4 +-- src/render/glyph_manager.js | 8 +++--- src/render/image_atlas.js | 8 +++--- src/render/image_manager.js | 14 +++++----- src/render/line_atlas.js | 2 +- src/render/painter.js | 18 ++++++------ src/render/program.js | 2 +- src/render/uniform_binding.js | 4 +-- src/source/geojson_worker_source.js | 4 +-- src/source/geojson_wrapper.js | 8 +++--- src/source/image_source.js | 2 +- src/source/query_features.js | 10 +++---- src/source/raster_dem_tile_worker_source.js | 2 +- src/source/source_cache.js | 24 ++++++++-------- src/source/source_state.js | 2 +- src/source/tile.js | 8 +++--- src/source/vector_tile_worker_source.js | 4 +-- src/source/worker.js | 10 +++---- src/source/worker_source.js | 4 +-- src/source/worker_tile.js | 8 +++--- .../expression/compound_expression.js | 6 ++-- .../expression/definitions/assertion.js | 2 +- src/style-spec/expression/definitions/at.js | 2 +- src/style-spec/expression/definitions/case.js | 2 +- .../expression/definitions/coalesce.js | 2 +- .../expression/definitions/coercion.js | 2 +- .../expression/definitions/collator.js | 2 +- .../expression/definitions/comparison.js | 2 +- .../expression/definitions/format.js | 2 +- .../definitions/format_section_override.js | 2 +- .../expression/definitions/image.js | 2 +- src/style-spec/expression/definitions/in.js | 2 +- .../expression/definitions/interpolate.js | 2 +- .../expression/definitions/length.js | 2 +- src/style-spec/expression/definitions/let.js | 2 +- .../expression/definitions/match.js | 2 +- .../expression/definitions/number_format.js | 2 +- src/style-spec/expression/definitions/step.js | 2 +- .../expression/evaluation_context.js | 2 +- src/style-spec/expression/expression.js | 2 +- src/style-spec/expression/index.js | 10 +++---- src/style-spec/expression/scope.js | 2 +- src/style-spec/feature_filter/convert.js | 2 +- src/style-spec/style-spec.js | 2 +- src/style-spec/types.js | 4 +-- src/style-spec/visit.js | 4 +-- src/style/load_glyph_range.js | 2 +- src/style/load_sprite.js | 2 +- src/style/pauseable_placement.js | 2 +- src/style/style.js | 16 +++++------ src/style/style_layer_index.js | 4 +-- src/symbol/cross_tile_symbol_index.js | 4 +-- src/symbol/mergelines.js | 4 +-- src/symbol/placement.js | 10 +++---- src/symbol/projection.js | 2 +- src/symbol/quads.js | 2 +- src/symbol/shaping.js | 28 +++++++++---------- src/symbol/symbol_layout.js | 18 ++++++------ src/ui/anchor.js | 2 +- src/ui/camera.js | 16 +++++------ src/ui/handler/scroll_zoom.js | 2 +- src/ui/map.js | 2 +- src/ui/popup.js | 2 +- src/util/dictionary_coder.js | 2 +- src/util/evented.js | 2 +- src/util/mapbox.js | 4 +-- src/util/web_worker.js | 2 +- src/util/web_worker_transfer.js | 4 +-- src/util/worker_pool.js | 2 +- 82 files changed, 219 insertions(+), 219 deletions(-) diff --git a/build/generate-flow-typed-style-spec.js b/build/generate-flow-typed-style-spec.js index 506f5ec532f..cbbbda16917 100644 --- a/build/generate-flow-typed-style-spec.js +++ b/build/generate-flow-typed-style-spec.js @@ -33,7 +33,7 @@ function flowType(property) { case 'light': return 'LightSpecification'; case 'sources': - return '{[string]: SourceSpecification}'; + return '{[_: string]: SourceSpecification}'; case '*': return 'mixed'; default: @@ -122,7 +122,7 @@ export type FormattedSpecification = string; export type ResolvedImageSpecification = string; -export type PromoteIdSpecification = {[string]: string} | string; +export type PromoteIdSpecification = {[_: string]: string} | string; export type FilterSpecification = | ['has', string] diff --git a/flow-typed/vector-tile.js b/flow-typed/vector-tile.js index efab5ef66e1..c56b04d33dd 100644 --- a/flow-typed/vector-tile.js +++ b/flow-typed/vector-tile.js @@ -3,7 +3,7 @@ import type Point from '@mapbox/point-geometry'; import type { GeoJSONFeature } from '@mapbox/geojson-types'; declare interface VectorTile { - layers: {[string]: VectorTileLayer}; + layers: {[_: string]: VectorTileLayer}; } declare interface VectorTileLayer { @@ -18,7 +18,7 @@ declare interface VectorTileFeature { extent: number; type: 1 | 2 | 3; id: number; - properties: {[string]: string | number | boolean}; + properties: {[_: string]: string | number | boolean}; loadGeometry(): Array>; toGeoJSON(x: number, y: number, z: number): GeoJSONFeature; diff --git a/src/data/bucket.js b/src/data/bucket.js index a6be33f9aa2..f93ba793a84 100644 --- a/src/data/bucket.js +++ b/src/data/bucket.js @@ -41,7 +41,7 @@ export type BucketFeature = {| properties: Object, type: 1 | 2 | 3, id?: any, - +patterns: {[string]: {"min": string, "mid": string, "max": string}}, + +patterns: {[_: string]: {"min": string, "mid": string, "max": string}}, sortKey?: number |}; @@ -75,7 +75,7 @@ export interface Bucket { +stateDependentLayers: Array; +stateDependentLayerIds: Array; populate(features: Array, options: PopulateParameters): void; - update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[string]: ImagePosition}): void; + update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}): void; isEmpty(): boolean; upload(context: Context): void; @@ -91,7 +91,7 @@ export interface Bucket { destroy(): void; } -export function deserialize(input: Array, style: Style): {[string]: Bucket} { +export function deserialize(input: Array, style: Style): {[_: string]: Bucket} { const output = {}; // Guard against the case where the map's style has been set to null while diff --git a/src/data/bucket/circle_bucket.js b/src/data/bucket/circle_bucket.js index 8feb187d1e0..5e2a37ec1d1 100644 --- a/src/data/bucket/circle_bucket.js +++ b/src/data/bucket/circle_bucket.js @@ -123,7 +123,7 @@ class CircleBucket implements Bucke } } - update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[string]: ImagePosition}) { + update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) { if (!this.stateDependentLayers.length) return; this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions); } diff --git a/src/data/bucket/fill_bucket.js b/src/data/bucket/fill_bucket.js index 711d200c007..48eac842225 100644 --- a/src/data/bucket/fill_bucket.js +++ b/src/data/bucket/fill_bucket.js @@ -124,12 +124,12 @@ class FillBucket implements Bucket { } } - update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[string]: ImagePosition}) { + update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) { if (!this.stateDependentLayers.length) return; this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions); } - addFeatures(options: PopulateParameters, imagePositions: {[string]: ImagePosition}) { + addFeatures(options: PopulateParameters, imagePositions: {[_: string]: ImagePosition}) { for (const feature of this.patternFeatures) { this.addFeature(feature, feature.geometry, feature.index, imagePositions); } @@ -162,7 +162,7 @@ class FillBucket implements Bucket { this.segments2.destroy(); } - addFeature(feature: BucketFeature, geometry: Array>, index: number, imagePositions: {[string]: ImagePosition}) { + addFeature(feature: BucketFeature, geometry: Array>, index: number, imagePositions: {[_: string]: ImagePosition}) { for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) { let numVertices = 0; for (const ring of polygon) { diff --git a/src/data/bucket/fill_extrusion_bucket.js b/src/data/bucket/fill_extrusion_bucket.js index 901f9e8079b..1f98d3d5dfc 100644 --- a/src/data/bucket/fill_extrusion_bucket.js +++ b/src/data/bucket/fill_extrusion_bucket.js @@ -120,14 +120,14 @@ class FillExtrusionBucket implements Bucket { } } - addFeatures(options: PopulateParameters, imagePositions: {[string]: ImagePosition}) { + addFeatures(options: PopulateParameters, imagePositions: {[_: string]: ImagePosition}) { for (const feature of this.features) { const {geometry} = feature; this.addFeature(feature, geometry, feature.index, imagePositions); } } - update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[string]: ImagePosition}) { + update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) { if (!this.stateDependentLayers.length) return; this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions); } @@ -157,7 +157,7 @@ class FillExtrusionBucket implements Bucket { this.segments.destroy(); } - addFeature(feature: BucketFeature, geometry: Array>, index: number, imagePositions: {[string]: ImagePosition}) { + addFeature(feature: BucketFeature, geometry: Array>, index: number, imagePositions: {[_: string]: ImagePosition}) { for (const polygon of classifyRings(geometry, EARCUT_MAX_RINGS)) { let numVertices = 0; for (const ring of polygon) { diff --git a/src/data/bucket/line_bucket.js b/src/data/bucket/line_bucket.js index bb63e4d3a4e..b68c54dbe9d 100644 --- a/src/data/bucket/line_bucket.js +++ b/src/data/bucket/line_bucket.js @@ -167,12 +167,12 @@ class LineBucket implements Bucket { } } - update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[string]: ImagePosition}) { + update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) { if (!this.stateDependentLayers.length) return; this.programConfigurations.updatePaintArrays(states, vtLayer, this.stateDependentLayers, imagePositions); } - addFeatures(options: PopulateParameters, imagePositions: {[string]: ImagePosition}) { + addFeatures(options: PopulateParameters, imagePositions: {[_: string]: ImagePosition}) { for (const feature of this.patternFeatures) { this.addFeature(feature, feature.geometry, feature.index, imagePositions); } @@ -203,7 +203,7 @@ class LineBucket implements Bucket { this.segments.destroy(); } - addFeature(feature: BucketFeature, geometry: Array>, index: number, imagePositions: {[string]: ImagePosition}) { + addFeature(feature: BucketFeature, geometry: Array>, index: number, imagePositions: {[_: string]: ImagePosition}) { const layout = this.layers[0].layout; const join = layout.get('line-join').evaluate(feature, {}); const cap = layout.get('line-cap'); @@ -215,7 +215,7 @@ class LineBucket implements Bucket { } } - addLine(vertices: Array, feature: BucketFeature, join: string, cap: string, miterLimit: number, roundLimit: number, index: number, imagePositions: {[string]: ImagePosition}) { + addLine(vertices: Array, feature: BucketFeature, join: string, cap: string, miterLimit: number, roundLimit: number, index: number, imagePositions: {[_: string]: ImagePosition}) { this.distance = 0; this.scaledDistance = 0; this.totalDistance = 0; diff --git a/src/data/bucket/symbol_bucket.js b/src/data/bucket/symbol_bucket.js index cdcb9ea72ef..8b23808bdbc 100644 --- a/src/data/bucket/symbol_bucket.js +++ b/src/data/bucket/symbol_bucket.js @@ -321,7 +321,7 @@ class SymbolBucket implements Bucket { sortKeyRanges: Array; pixelRatio: number; tilePixelRatio: number; - compareText: {[string]: Array}; + compareText: {[_: string]: Array}; fadeStartTime: number; sortFeaturesByKey: boolean; sortFeaturesByY: boolean; @@ -387,7 +387,7 @@ class SymbolBucket implements Bucket { this.symbolInstances = new SymbolInstanceArray(); } - calculateGlyphDependencies(text: string, stack: {[number]: boolean}, textAlongLine: boolean, allowVerticalPlacement: boolean, doesAllowVerticalWritingMode: boolean) { + calculateGlyphDependencies(text: string, stack: {[_: number]: boolean}, textAlongLine: boolean, allowVerticalPlacement: boolean, doesAllowVerticalWritingMode: boolean) { for (let i = 0; i < text.length; i++) { stack[text.charCodeAt(i)] = true; if ((textAlongLine || allowVerticalPlacement) && doesAllowVerticalWritingMode) { @@ -523,7 +523,7 @@ class SymbolBucket implements Bucket { } } - update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[string]: ImagePosition}) { + update(states: FeatureStates, vtLayer: VectorTileLayer, imagePositions: {[_: string]: ImagePosition}) { if (!this.stateDependentLayers.length) return; this.text.programConfigurations.updatePaintArrays(states, vtLayer, this.layers, imagePositions); this.icon.programConfigurations.updatePaintArrays(states, vtLayer, this.layers, imagePositions); diff --git a/src/data/feature_index.js b/src/data/feature_index.js index eca434d7c1b..85bc7782385 100644 --- a/src/data/feature_index.js +++ b/src/data/feature_index.js @@ -51,7 +51,7 @@ class FeatureIndex { rawTileData: ArrayBuffer; bucketLayerIDs: Array>; - vtLayers: {[string]: VectorTileLayer}; + vtLayers: {[_: string]: VectorTileLayer}; sourceLayerCoder: DictionaryCoder; constructor(tileID: OverscaledTileID, promoteId?: ?PromoteIdSpecification) { @@ -92,7 +92,7 @@ class FeatureIndex { } } - loadVTLayers(): {[string]: VectorTileLayer} { + loadVTLayers(): {[_: string]: VectorTileLayer} { if (!this.vtLayers) { this.vtLayers = new vt.VectorTile(new Protobuf(this.rawTileData)).layers; this.sourceLayerCoder = new DictionaryCoder(this.vtLayers ? Object.keys(this.vtLayers).sort() : ['_geojsonTileLayer']); @@ -101,7 +101,7 @@ class FeatureIndex { } // Finds non-symbol features in this tile at a particular position. - query(args: QueryParameters, styleLayers: {[string]: StyleLayer}, sourceFeatureState: SourceFeatureState): {[string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} { + query(args: QueryParameters, styleLayers: {[_: string]: StyleLayer}, sourceFeatureState: SourceFeatureState): {[_: string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} { this.loadVTLayers(); const params = args.params || {}, @@ -164,13 +164,13 @@ class FeatureIndex { } loadMatchingFeature( - result: {[string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>}, + result: {[_: string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>}, bucketIndex: number, sourceLayerIndex: number, featureIndex: number, filter: FeatureFilter, filterLayerIDs: Array, - styleLayers: {[string]: StyleLayer}, + styleLayers: {[_: string]: StyleLayer}, intersectionTest?: (feature: VectorTileFeature, styleLayer: StyleLayer, id: string | number | void) => boolean | number) { const layerIDs = this.bucketLayerIDs[bucketIndex]; @@ -219,7 +219,7 @@ class FeatureIndex { sourceLayerIndex: number, filterSpec: FilterSpecification, filterLayerIDs: Array, - styleLayers: {[string]: StyleLayer}) { + styleLayers: {[_: string]: StyleLayer}) { const result = {}; this.loadVTLayers(); diff --git a/src/data/program_configuration.js b/src/data/program_configuration.js index d6451b2ad58..22e9cba0d3f 100644 --- a/src/data/program_configuration.js +++ b/src/data/program_configuration.js @@ -77,8 +77,8 @@ function packColor(color: Color): [number, number] { */ interface AttributeBinder { - populatePaintArray(length: number, feature: Feature, imagePositions: {[string]: ImagePosition}, formattedSection?: FormattedSection): void; - updatePaintArray(start: number, length: number, feature: Feature, featureState: FeatureState, imagePositions: {[string]: ImagePosition}): void; + populatePaintArray(length: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, formattedSection?: FormattedSection): void; + updatePaintArray(start: number, length: number, feature: Feature, featureState: FeatureState, imagePositions: {[_: string]: ImagePosition}): void; upload(Context): void; destroy(): void; } @@ -161,7 +161,7 @@ class SourceExpressionBinder implements AttributeBinder { this.paintVertexArray = new PaintVertexArray(); } - populatePaintArray(newLength: number, feature: Feature, imagePositions: {[string]: ImagePosition}, formattedSection?: FormattedSection) { + populatePaintArray(newLength: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, formattedSection?: FormattedSection) { const start = this.paintVertexArray.length; const value = this.expression.evaluate(new EvaluationParameters(0), feature, {}, [], formattedSection); this.paintVertexArray.resize(newLength); @@ -232,7 +232,7 @@ class CompositeExpressionBinder implements AttributeBinder, UniformBinder { this.paintVertexArray = new PaintVertexArray(); } - populatePaintArray(newLength: number, feature: Feature, imagePositions: {[string]: ImagePosition}, formattedSection?: FormattedSection) { + populatePaintArray(newLength: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, formattedSection?: FormattedSection) { const min = this.expression.evaluate(new EvaluationParameters(this.zoom), feature, {}, [], formattedSection); const max = this.expression.evaluate(new EvaluationParameters(this.zoom + 1), feature, {}, [], formattedSection); const start = this.paintVertexArray.length; @@ -319,14 +319,14 @@ class CrossFadedCompositeBinder implements AttributeBinder { this.zoomOutPaintVertexArray = new PaintVertexArray(); } - populatePaintArray(length: number, feature: Feature, imagePositions: {[string]: ImagePosition}) { + populatePaintArray(length: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}) { const start = this.zoomInPaintVertexArray.length; this.zoomInPaintVertexArray.resize(length); this.zoomOutPaintVertexArray.resize(length); this._setPaintValues(start, length, feature.patterns && feature.patterns[this.layerId], imagePositions); } - updatePaintArray(start: number, end: number, feature: Feature, featureState: FeatureState, imagePositions: {[string]: ImagePosition}) { + updatePaintArray(start: number, end: number, feature: Feature, featureState: FeatureState, imagePositions: {[_: string]: ImagePosition}) { this._setPaintValues(start, end, feature.patterns && feature.patterns[this.layerId], imagePositions); } @@ -388,13 +388,13 @@ class CrossFadedCompositeBinder implements AttributeBinder { * @private */ export default class ProgramConfiguration { - binders: { [string]: (AttributeBinder | UniformBinder) }; + binders: {[_: string]: (AttributeBinder | UniformBinder) }; cacheKey: string; layoutAttributes: Array; _buffers: Array; - constructor(layer: TypedStyleLayer, zoom: number, filterProperties: (string) => boolean, layoutAttributes: Array) { + constructor(layer: TypedStyleLayer, zoom: number, filterProperties: (_: string) => boolean, layoutAttributes: Array) { this.binders = {}; this.layoutAttributes = layoutAttributes; this._buffers = []; @@ -442,7 +442,7 @@ export default class ProgramConfiguration { return binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder ? binder.maxValue : 0; } - populatePaintArrays(newLength: number, feature: Feature, imagePositions: {[string]: ImagePosition}, formattedSection?: FormattedSection) { + populatePaintArrays(newLength: number, feature: Feature, imagePositions: {[_: string]: ImagePosition}, formattedSection?: FormattedSection) { for (const property in this.binders) { const binder = this.binders[property]; if (binder instanceof SourceExpressionBinder || binder instanceof CompositeExpressionBinder || binder instanceof CrossFadedCompositeBinder) @@ -457,7 +457,7 @@ export default class ProgramConfiguration { } } - updatePaintArrays(featureStates: FeatureStates, featureMap: FeaturePositionMap, vtLayer: VectorTileLayer, layer: TypedStyleLayer, imagePositions: {[string]: ImagePosition}): boolean { + updatePaintArrays(featureStates: FeatureStates, featureMap: FeaturePositionMap, vtLayer: VectorTileLayer, layer: TypedStyleLayer, imagePositions: {[_: string]: ImagePosition}): boolean { let dirty: boolean = false; for (const id in featureStates) { const positions = featureMap.getPositions(id); @@ -554,12 +554,12 @@ export default class ProgramConfiguration { } export class ProgramConfigurationSet { - programConfigurations: {[string]: ProgramConfiguration}; + programConfigurations: {[_: string]: ProgramConfiguration}; needsUpload: boolean; _featureMap: FeaturePositionMap; _bufferOffset: number; - constructor(layoutAttributes: Array, layers: $ReadOnlyArray, zoom: number, filterProperties: (string) => boolean = () => true) { + constructor(layoutAttributes: Array, layers: $ReadOnlyArray, zoom: number, filterProperties: (_: string) => boolean = () => true) { this.programConfigurations = {}; for (const layer of layers) { this.programConfigurations[layer.id] = new ProgramConfiguration(layer, zoom, filterProperties, layoutAttributes); @@ -569,7 +569,7 @@ export class ProgramConfigurationSet { this._bufferOffset = 0; } - populatePaintArrays(length: number, feature: Feature, index: number, imagePositions: {[string]: ImagePosition}, formattedSection?: FormattedSection) { + populatePaintArrays(length: number, feature: Feature, index: number, imagePositions: {[_: string]: ImagePosition}, formattedSection?: FormattedSection) { for (const key in this.programConfigurations) { this.programConfigurations[key].populatePaintArrays(length, feature, imagePositions, formattedSection); } @@ -582,7 +582,7 @@ export class ProgramConfigurationSet { this.needsUpload = true; } - updatePaintArrays(featureStates: FeatureStates, vtLayer: VectorTileLayer, layers: $ReadOnlyArray, imagePositions: {[string]: ImagePosition}) { + updatePaintArrays(featureStates: FeatureStates, vtLayer: VectorTileLayer, layers: $ReadOnlyArray, imagePositions: {[_: string]: ImagePosition}) { for (const layer of layers) { this.needsUpload = this.programConfigurations[layer.id].updatePaintArrays(featureStates, this._featureMap, vtLayer, layer, imagePositions) || this.needsUpload; } diff --git a/src/data/segment.js b/src/data/segment.js index 664cf2df6ee..3e4a582c0c0 100644 --- a/src/data/segment.js +++ b/src/data/segment.js @@ -13,7 +13,7 @@ export type Segment = { primitiveOffset: number, vertexLength: number, primitiveLength: number, - vaos: {[string]: VertexArrayObject} + vaos: {[_: string]: VertexArrayObject} } class SegmentVector { diff --git a/src/geo/transform.js b/src/geo/transform.js index 7e5b232dc94..f44bb5a6964 100644 --- a/src/geo/transform.js +++ b/src/geo/transform.js @@ -53,8 +53,8 @@ class Transform { _center: LngLat; _edgeInsets: EdgeInsets; _constraining: boolean; - _posMatrixCache: {[string]: Float32Array}; - _alignedPosMatrixCache: {[string]: Float32Array}; + _posMatrixCache: {[_: string]: Float32Array}; + _alignedPosMatrixCache: {[_: string]: Float32Array}; constructor(minZoom: ?number, maxZoom: ?number, minPitch: ?number, maxPitch: ?number, renderWorldCopies: boolean | void) { this.tileSize = 512; // constant diff --git a/src/render/draw_symbol.js b/src/render/draw_symbol.js index fb452721628..f20d48ffc75 100644 --- a/src/render/draw_symbol.js +++ b/src/render/draw_symbol.js @@ -52,7 +52,7 @@ type SymbolTileRenderState = { } }; -function drawSymbols(painter: Painter, sourceCache: SourceCache, layer: SymbolStyleLayer, coords: Array, variableOffsets: {[CrossTileID]: VariableOffset}) { +function drawSymbols(painter: Painter, sourceCache: SourceCache, layer: SymbolStyleLayer, coords: Array, variableOffsets: {[_: CrossTileID]: VariableOffset}) { if (painter.renderPass !== 'translucent') return; // Disable the stencil test so that labels aren't clipped to tile boundaries. diff --git a/src/render/glyph_atlas.js b/src/render/glyph_atlas.js index a6bcd71a0db..6f68bd00c63 100644 --- a/src/render/glyph_atlas.js +++ b/src/render/glyph_atlas.js @@ -20,13 +20,13 @@ export type GlyphPosition = { metrics: GlyphMetrics }; -export type GlyphPositions = { [string]: { [number]: GlyphPosition } } +export type GlyphPositions = {[_: string]: {[_: number]: GlyphPosition } } export default class GlyphAtlas { image: AlphaImage; positions: GlyphPositions; - constructor(stacks: { [string]: { [number]: ?StyleGlyph } }) { + constructor(stacks: {[_: string]: {[_: number]: ?StyleGlyph } }) { const positions = {}; const bins = []; diff --git a/src/render/glyph_manager.js b/src/render/glyph_manager.js index 7a8079dda6e..556d3aa0597 100644 --- a/src/render/glyph_manager.js +++ b/src/render/glyph_manager.js @@ -14,14 +14,14 @@ import type {Callback} from '../types/callback'; type Entry = { // null means we've requested the range, but the glyph wasn't included in the result. glyphs: {[id: number]: StyleGlyph | null}, - requests: {[range: number]: Array>}, + requests: {[range: number]: Array>}, tinySDF?: TinySDF }; class GlyphManager { requestManager: RequestManager; localIdeographFontFamily: ?string; - entries: {[string]: Entry}; + entries: {[_: string]: Entry}; url: ?string; // exposed as statics to enable stubbing in unit tests @@ -79,7 +79,7 @@ class GlyphManager { if (!requests) { requests = entry.requests[range] = []; GlyphManager.loadGlyphRange(stack, range, (this.url: any), this.requestManager, - (err, response: ?{[number]: StyleGlyph | null}) => { + (err, response: ?{[_: number]: StyleGlyph | null}) => { if (response) { for (const id in response) { if (!this._doesCharSupportLocalGlyph(+id)) { @@ -94,7 +94,7 @@ class GlyphManager { }); } - requests.push((err, result: ?{[number]: StyleGlyph | null}) => { + requests.push((err, result: ?{[_: number]: StyleGlyph | null}) => { if (err) { callback(err); } else if (result) { diff --git a/src/render/image_atlas.js b/src/render/image_atlas.js index c5234e24133..aeab7b91a70 100644 --- a/src/render/image_atlas.js +++ b/src/render/image_atlas.js @@ -63,12 +63,12 @@ export class ImagePosition { export default class ImageAtlas { image: RGBAImage; - iconPositions: {[string]: ImagePosition}; - patternPositions: {[string]: ImagePosition}; + iconPositions: {[_: string]: ImagePosition}; + patternPositions: {[_: string]: ImagePosition}; haveRenderCallbacks: Array; uploaded: ?boolean; - constructor(icons: {[string]: StyleImage}, patterns: {[string]: StyleImage}) { + constructor(icons: {[_: string]: StyleImage}, patterns: {[_: string]: StyleImage}) { const iconPositions = {}, patternPositions = {}; this.haveRenderCallbacks = []; @@ -107,7 +107,7 @@ export default class ImageAtlas { this.patternPositions = patternPositions; } - addImages(images: {[string]: StyleImage}, positions: {[string]: ImagePosition}, bins: Array) { + addImages(images: {[_: string]: StyleImage}, positions: {[_: string]: ImagePosition}, bins: Array) { for (const id in images) { const src = images[id]; const bin = { diff --git a/src/render/image_manager.js b/src/render/image_manager.js index 65fc94c24b6..8bf32f5f07b 100644 --- a/src/render/image_manager.js +++ b/src/render/image_manager.js @@ -38,13 +38,13 @@ const padding = 1; to refactor this. */ class ImageManager extends Evented { - images: {[string]: StyleImage}; - updatedImages: {[string]: boolean}; - callbackDispatchedThisFrame: {[string]: boolean}; + images: {[_: string]: StyleImage}; + updatedImages: {[_: string]: boolean}; + callbackDispatchedThisFrame: {[_: string]: boolean}; loaded: boolean; - requestors: Array<{ids: Array, callback: Callback<{[string]: StyleImage}>}>; + requestors: Array<{ids: Array, callback: Callback<{[_: string]: StyleImage}>}>; - patterns: {[string]: Pattern}; + patterns: {[_: string]: Pattern}; atlasImage: RGBAImage; atlasTexture: ?Texture; dirty: boolean; @@ -156,7 +156,7 @@ class ImageManager extends Evented { return Object.keys(this.images); } - getImages(ids: Array, callback: Callback<{[string]: StyleImage}>) { + getImages(ids: Array, callback: Callback<{[_: string]: StyleImage}>) { // If the sprite has been loaded, or if all the icon dependencies are already present // (i.e. if they've been added via runtime styling), then notify the requestor immediately. // Otherwise, delay notification until the sprite is loaded. At that point, if any of the @@ -176,7 +176,7 @@ class ImageManager extends Evented { } } - _notify(ids: Array, callback: Callback<{[string]: StyleImage}>) { + _notify(ids: Array, callback: Callback<{[_: string]: StyleImage}>) { const response = {}; for (const id of ids) { diff --git a/src/render/line_atlas.js b/src/render/line_atlas.js index fd6af715271..ddf42269878 100644 --- a/src/render/line_atlas.js +++ b/src/render/line_atlas.js @@ -19,7 +19,7 @@ class LineAtlas { nextRow: number; bytes: number; data: Uint8Array; - dashEntry: {[string]: any}; + dashEntry: {[_: string]: any}; dirty: boolean; texture: WebGLTexture; diff --git a/src/render/painter.js b/src/render/painter.js index 01f51643923..0d815708151 100644 --- a/src/render/painter.js +++ b/src/render/painter.js @@ -86,7 +86,7 @@ type PainterOptions = { class Painter { context: Context; transform: Transform; - _tileTextures: { [number]: Array }; + _tileTextures: {[_: number]: Array }; numSublayers: number; depthEpsilon: number; emptyProgramConfiguration: ProgramConfiguration; @@ -104,7 +104,7 @@ class Painter { viewportSegments: SegmentVector; quadTriangleIndexBuffer: IndexBuffer; tileBorderIndexBuffer: IndexBuffer; - _tileClippingMaskIDs: { [string]: number }; + _tileClippingMaskIDs: {[_: string]: number }; stencilClearMode: StencilMode; style: Style; options: PainterOptions; @@ -119,10 +119,10 @@ class Painter { nextStencilID: number; id: string; _showOverdrawInspector: boolean; - cache: { [string]: Program<*> }; + cache: {[_: string]: Program<*> }; crossTileSymbolIndex: CrossTileSymbolIndex; symbolFadeChange: number; - gpuTimers: { [string]: any }; + gpuTimers: {[_: string]: any }; constructor(gl: WebGLRenderingContext, transform: Transform) { this.context = new Context(gl); @@ -304,7 +304,7 @@ class Painter { * * Returns [StencilMode for tile overscaleZ map, sortedCoords]. */ - stencilConfigForOverlap(tileIDs: Array): [{[number]: $ReadOnly}, Array] { + stencilConfigForOverlap(tileIDs: Array): [{[_: number]: $ReadOnly}, Array] { const gl = this.context.gl; const coords = tileIDs.sort((a, b) => b.overscaledZ - a.overscaledZ); const minTileZ = coords[coords.length - 1].overscaledZ; @@ -377,9 +377,9 @@ class Painter { } } - const coordsAscending: {[string]: Array} = {}; - const coordsDescending: {[string]: Array} = {}; - const coordsDescendingSymbol: {[string]: Array} = {}; + const coordsAscending: {[_: string]: Array} = {}; + const coordsDescending: {[_: string]: Array} = {}; + const coordsDescendingSymbol: {[_: string]: Array} = {}; for (const id in sourceCaches) { const sourceCache = sourceCaches[id]; @@ -532,7 +532,7 @@ class Painter { return currentLayerTimers; } - queryGpuTimers(gpuTimers: {[string]: any}) { + queryGpuTimers(gpuTimers: {[_: string]: any}) { const layers = {}; for (const layerId in gpuTimers) { const gpuTimer = gpuTimers[layerId]; diff --git a/src/render/program.js b/src/render/program.js index eccc47973c7..db1f9386e57 100644 --- a/src/render/program.js +++ b/src/render/program.js @@ -23,7 +23,7 @@ export type DrawMode = class Program { program: WebGLProgram; - attributes: {[string]: number}; + attributes: {[_: string]: number}; numAttributes: number; fixedUniforms: Us; binderUniforms: Array; diff --git a/src/render/uniform_binding.js b/src/render/uniform_binding.js index 38fcfeebd88..4cb0c5f32ee 100644 --- a/src/render/uniform_binding.js +++ b/src/render/uniform_binding.js @@ -6,7 +6,7 @@ import type Context from '../gl/context'; export type UniformValues = $Exact<$ObjMap(u: Uniform) => V>>; -export type UniformLocations = {[string]: WebGLUniformLocation}; +export type UniformLocations = {[_: string]: WebGLUniformLocation}; class Uniform { gl: WebGLRenderingContext; @@ -144,4 +144,4 @@ export { UniformMatrix4f }; -export type UniformBindings = {[string]: Uniform}; +export type UniformBindings = {[_: string]: Uniform}; diff --git a/src/source/geojson_worker_source.js b/src/source/geojson_worker_source.js index 1227be062b0..01c9e11f8d0 100644 --- a/src/source/geojson_worker_source.js +++ b/src/source/geojson_worker_source.js @@ -94,7 +94,7 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource { loadGeoJSON: LoadGeoJSON; _state: SourceState; _pendingCallback: Callback<{ - resourceTiming?: {[string]: Array}, + resourceTiming?: {[_: string]: Array}, abandoned?: boolean }>; _pendingLoadDataParams: LoadGeoJSONParameters; _geoJSONIndex: GeoJSONIndex @@ -128,7 +128,7 @@ class GeoJSONWorkerSource extends VectorTileWorkerSource { * @param callback */ loadData(params: LoadGeoJSONParameters, callback: Callback<{ - resourceTiming?: {[string]: Array}, + resourceTiming?: {[_: string]: Array}, abandoned?: boolean }>) { if (this._pendingCallback) { // Tell the foreground the previous call has been abandoned diff --git a/src/source/geojson_wrapper.js b/src/source/geojson_wrapper.js index 40e44f22278..35a23afd2c3 100644 --- a/src/source/geojson_wrapper.js +++ b/src/source/geojson_wrapper.js @@ -11,12 +11,12 @@ import EXTENT from '../data/extent'; type Feature = { type: 1, id: mixed, - tags: {[string]: string | number | boolean}, + tags: {[_: string]: string | number | boolean}, geometry: Array<[number, number]>, } | { type: 2 | 3, id: mixed, - tags: {[string]: string | number | boolean}, + tags: {[_: string]: string | number | boolean}, geometry: Array>, } @@ -26,7 +26,7 @@ class FeatureWrapper implements VectorTileFeature { extent: number; type: 1 | 2 | 3; id: number; - properties: {[string]: string | number | boolean}; + properties: {[_: string]: string | number | boolean}; constructor(feature: Feature) { this._feature = feature; @@ -72,7 +72,7 @@ class FeatureWrapper implements VectorTileFeature { } class GeoJSONWrapper implements VectorTile, VectorTileLayer { - layers: {[string]: VectorTileLayer}; + layers: {[_: string]: VectorTileLayer}; name: string; extent: number; length: number; diff --git a/src/source/image_source.js b/src/source/image_source.js index 141b4dbf41c..a96ffeea342 100644 --- a/src/source/image_source.js +++ b/src/source/image_source.js @@ -73,7 +73,7 @@ class ImageSource extends Evented implements Source { url: string; coordinates: Coordinates; - tiles: {[string]: Tile}; + tiles: {[_: string]: Tile}; options: any; dispatcher: Dispatcher; map: Map; diff --git a/src/source/query_features.js b/src/source/query_features.js index 038690e0cdf..c37cef012ed 100644 --- a/src/source/query_features.js +++ b/src/source/query_features.js @@ -19,7 +19,7 @@ function getPixelPosMatrix(transform, tileID) { return mat4.multiply(t, t, transform.calculatePosMatrix(tileID.toUnwrapped())); } -function queryIncludes3DLayer(layers?: Array, styleLayers: {[string]: StyleLayer}, sourceID: string) { +function queryIncludes3DLayer(layers?: Array, styleLayers: {[_: string]: StyleLayer}, sourceID: string) { if (layers) { for (const layerID of layers) { const layer = styleLayers[layerID]; @@ -39,7 +39,7 @@ function queryIncludes3DLayer(layers?: Array, styleLayers: {[string]: St } export function queryRenderedFeatures(sourceCache: SourceCache, - styleLayers: {[string]: StyleLayer}, + styleLayers: {[_: string]: StyleLayer}, queryGeometry: Array, params: { filter: FilterSpecification, layers: Array }, transform: Transform) { @@ -85,12 +85,12 @@ export function queryRenderedFeatures(sourceCache: SourceCache, return result; } -export function queryRenderedSymbols(styleLayers: {[string]: StyleLayer}, - sourceCaches: {[string]: SourceCache}, +export function queryRenderedSymbols(styleLayers: {[_: string]: StyleLayer}, + sourceCaches: {[_: string]: SourceCache}, queryGeometry: Array, params: { filter: FilterSpecification, layers: Array }, collisionIndex: CollisionIndex, - retainedQueryData: {[number]: RetainedQueryData}) { + retainedQueryData: {[_: number]: RetainedQueryData}) { const result = {}; const renderedSymbols = collisionIndex.queryRenderedSymbols(queryGeometry); const bucketQueryData = []; diff --git a/src/source/raster_dem_tile_worker_source.js b/src/source/raster_dem_tile_worker_source.js index ef965491285..416462ea169 100644 --- a/src/source/raster_dem_tile_worker_source.js +++ b/src/source/raster_dem_tile_worker_source.js @@ -14,7 +14,7 @@ const {ImageBitmap} = window; class RasterDEMTileWorkerSource { actor: Actor; - loaded: {[string]: DEMData}; + loaded: {[_: string]: DEMData}; offscreenCanvas: OffscreenCanvas; offscreenCanvasContext: CanvasRenderingContext2D; diff --git a/src/source/source_cache.js b/src/source/source_cache.js index 5283cca6bf2..60a4ff578a5 100644 --- a/src/source/source_cache.js +++ b/src/source/source_cache.js @@ -44,20 +44,20 @@ class SourceCache extends Evented { _source: Source; _sourceLoaded: boolean; _sourceErrored: boolean; - _tiles: {[string]: Tile}; + _tiles: {[_: string]: Tile}; _prevLng: number | void; _cache: TileCache; - _timers: {[any]: TimeoutID}; - _cacheTimers: {[any]: TimeoutID}; + _timers: {[_: any]: TimeoutID}; + _cacheTimers: {[_: any]: TimeoutID}; _maxTileCacheSize: ?number; _paused: boolean; _shouldReloadOnResume: boolean; - _coveredTiles: {[string]: boolean}; + _coveredTiles: {[_: string]: boolean}; transform: Transform; _isIdRenderable: (id: string, symbolLayer?: boolean) => boolean; used: boolean; _state: SourceFeatureState; - _loadedParentTiles: {[string]: ?Tile}; + _loadedParentTiles: {[_: string]: ?Tile}; static maxUnderzooming: number; static maxOverzooming: number; @@ -324,10 +324,10 @@ class SourceCache extends Evented { * between `zoom` (exclusive) and `maxCoveringZoom` (inclusive) */ _retainLoadedChildren( - idealTiles: {[any]: OverscaledTileID}, + idealTiles: {[_: any]: OverscaledTileID}, zoom: number, maxCoveringZoom: number, - retain: {[any]: OverscaledTileID} + retain: {[_: any]: OverscaledTileID} ) { for (const id in this._tiles) { let tile = this._tiles[id]; @@ -439,7 +439,7 @@ class SourceCache extends Evented { this._prevLng = lng; if (wrapDelta) { - const tiles: {[string]: Tile} = {}; + const tiles: {[_: string]: Tile} = {}; for (const key in this._tiles) { const tile = this._tiles[key]; tile.tileID = tile.tileID.unwrapTo(tile.tileID.wrap + wrapDelta); @@ -505,7 +505,7 @@ class SourceCache extends Evented { const retain = this._updateRetainedTiles(idealTileIDs, zoom); if (isRasterType(this._source.type)) { - const parentsForFading: {[string]: OverscaledTileID} = {}; + const parentsForFading: {[_: string]: OverscaledTileID} = {}; const fadingTiles = {}; const ids = Object.keys(retain); for (const id of ids) { @@ -566,9 +566,9 @@ class SourceCache extends Evented { } } - _updateRetainedTiles(idealTileIDs: Array, zoom: number): { [string]: OverscaledTileID} { - const retain: {[string]: OverscaledTileID} = {}; - const checked: {[string]: boolean } = {}; + _updateRetainedTiles(idealTileIDs: Array, zoom: number): {[_: string]: OverscaledTileID} { + const retain: {[_: string]: OverscaledTileID} = {}; + const checked: {[_: string]: boolean } = {}; const minCoveringZoom = Math.max(zoom - SourceCache.maxOverzooming, this._source.minzoom); const maxCoveringZoom = Math.max(zoom + SourceCache.maxUnderzooming, this._source.minzoom); diff --git a/src/source/source_state.js b/src/source/source_state.js index ff69cc0f87f..1cc4d03d99f 100644 --- a/src/source/source_state.js +++ b/src/source/source_state.js @@ -103,7 +103,7 @@ class SourceFeatureState { tile.setFeatureState(this.state, painter); } - coalesceChanges(tiles: {[any]: Tile}, painter: any) { + coalesceChanges(tiles: {[_: any]: Tile}, painter: any) { //track changes with full state objects, but only for features that got modified const featuresChanged: LayerFeatureStates = {}; diff --git a/src/source/tile.js b/src/source/tile.js index 35aa5ea66cb..4b4f5866cc6 100644 --- a/src/source/tile.js +++ b/src/source/tile.js @@ -51,7 +51,7 @@ class Tile { uid: number; uses: number; tileSize: number; - buckets: {[string]: Bucket}; + buckets: {[_: string]: Bucket}; latestFeatureIndex: ?FeatureIndex; latestRawTileData: ?ArrayBuffer; imageAtlas: ?ImageAtlas; @@ -68,7 +68,7 @@ class Tile { showCollisionBoxes: boolean; placementSource: any; actor: ?Actor; - vtLayers: {[string]: VectorTileLayer}; + vtLayers: {[_: string]: VectorTileLayer}; neighboringTiles: ?Object; dem: ?DEMData; @@ -264,7 +264,7 @@ class Tile { // Queries non-symbol features rendered for this tile. // Symbol features are queried globally - queryRenderedFeatures(layers: {[string]: StyleLayer}, + queryRenderedFeatures(layers: {[_: string]: StyleLayer}, sourceFeatureState: SourceFeatureState, queryGeometry: Array, cameraQueryGeometry: Array, @@ -272,7 +272,7 @@ class Tile { params: { filter: FilterSpecification, layers: Array }, transform: Transform, maxPitchScaleFactor: number, - pixelPosMatrix: Float32Array): {[string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} { + pixelPosMatrix: Float32Array): {[_: string]: Array<{ featureIndex: number, feature: GeoJSONFeature }>} { if (!this.latestFeatureIndex || !this.latestFeatureIndex.rawTileData) return {}; diff --git a/src/source/vector_tile_worker_source.js b/src/source/vector_tile_worker_source.js index 9cc29ac5890..bbdb32dd3f2 100644 --- a/src/source/vector_tile_worker_source.js +++ b/src/source/vector_tile_worker_source.js @@ -74,8 +74,8 @@ class VectorTileWorkerSource implements WorkerSource { layerIndex: StyleLayerIndex; availableImages: Array; loadVectorData: LoadVectorData; - loading: { [string]: WorkerTile }; - loaded: { [string]: WorkerTile }; + loading: {[_: string]: WorkerTile }; + loaded: {[_: string]: WorkerTile }; /** * @param [loadVectorData] Optional method for custom loading of a VectorTile diff --git a/src/source/worker.js b/src/source/worker.js index 7996d4caa6f..ab6827e3afc 100644 --- a/src/source/worker.js +++ b/src/source/worker.js @@ -30,11 +30,11 @@ import type {PluginState} from './rtl_text_plugin'; export default class Worker { self: WorkerGlobalScopeInterface; actor: Actor; - layerIndexes: { [string]: StyleLayerIndex }; - availableImages: { [string]: Array }; - workerSourceTypes: { [string]: Class }; - workerSources: { [string]: { [string]: { [string]: WorkerSource } } }; - demWorkerSources: { [string]: { [string]: RasterDEMTileWorkerSource } }; + layerIndexes: {[_: string]: StyleLayerIndex }; + availableImages: {[_: string]: Array }; + workerSourceTypes: {[_: string]: Class }; + workerSources: {[_: string]: {[_: string]: {[_: string]: WorkerSource } } }; + demWorkerSources: {[_: string]: {[_: string]: RasterDEMTileWorkerSource } }; referrer: ?string; constructor(self: WorkerGlobalScopeInterface) { diff --git a/src/source/worker_source.js b/src/source/worker_source.js index e5abafc1c2a..7acc8140728 100644 --- a/src/source/worker_source.js +++ b/src/source/worker_source.js @@ -48,8 +48,8 @@ export type WorkerTileResult = { rawTileData?: ArrayBuffer, resourceTiming?: Array, // Only used for benchmarking: - glyphMap?: {[string]: {[number]: ?StyleGlyph}} | null, - iconMap?: {[string]: StyleImage} | null, + glyphMap?: {[_: string]: {[_: number]: ?StyleGlyph}} | null, + iconMap?: {[_: string]: StyleImage} | null, glyphPositions?: GlyphPositions | null }; diff --git a/src/source/worker_tile.js b/src/source/worker_tile.js index 2f07b0de416..4a49625997b 100644 --- a/src/source/worker_tile.js +++ b/src/source/worker_tile.js @@ -73,7 +73,7 @@ class WorkerTile { const featureIndex = new FeatureIndex(this.tileID, this.promoteId); featureIndex.bucketLayerIDs = []; - const buckets: {[string]: Bucket} = {}; + const buckets: {[_: string]: Bucket} = {}; const options = { featureIndex, @@ -130,9 +130,9 @@ class WorkerTile { } let error: ?Error; - let glyphMap: ?{[string]: {[number]: ?StyleGlyph}}; - let iconMap: ?{[string]: StyleImage}; - let patternMap: ?{[string]: StyleImage}; + let glyphMap: ?{[_: string]: {[_: number]: ?StyleGlyph}}; + let iconMap: ?{[_: string]: StyleImage}; + let patternMap: ?{[_: string]: StyleImage}; const stacks = mapObject(options.glyphDependencies, (glyphs) => Object.keys(glyphs).map(Number)); if (Object.keys(stacks).length) { diff --git a/src/style-spec/expression/compound_expression.js b/src/style-spec/expression/compound_expression.js index 5240cba251e..af251d7299e 100644 --- a/src/style-spec/expression/compound_expression.js +++ b/src/style-spec/expression/compound_expression.js @@ -22,7 +22,7 @@ class CompoundExpression implements Expression { _evaluate: Evaluate; args: Array; - static definitions: { [string]: Definition }; + static definitions: {[_: string]: Definition }; constructor(name: string, type: Type, evaluate: Evaluate, args: Array) { this.name = name; @@ -35,7 +35,7 @@ class CompoundExpression implements Expression { return this._evaluate(ctx, this.args); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { this.args.forEach(fn); } @@ -141,7 +141,7 @@ class CompoundExpression implements Expression { static register( registry: ExpressionRegistry, - definitions: { [string]: Definition } + definitions: {[_: string]: Definition } ) { assert(!CompoundExpression.definitions); CompoundExpression.definitions = definitions; diff --git a/src/style-spec/expression/definitions/assertion.js b/src/style-spec/expression/definitions/assertion.js index 4e413597a57..6ce5d88cf70 100644 --- a/src/style-spec/expression/definitions/assertion.js +++ b/src/style-spec/expression/definitions/assertion.js @@ -101,7 +101,7 @@ class Assertion implements Expression { return null; } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { this.args.forEach(fn); } diff --git a/src/style-spec/expression/definitions/at.js b/src/style-spec/expression/definitions/at.js index 8a31b1fa88a..a6c3b93dd4a 100644 --- a/src/style-spec/expression/definitions/at.js +++ b/src/style-spec/expression/definitions/at.js @@ -53,7 +53,7 @@ class At implements Expression { return array[index]; } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.index); fn(this.input); } diff --git a/src/style-spec/expression/definitions/case.js b/src/style-spec/expression/definitions/case.js index f952e828306..005b92c6155 100644 --- a/src/style-spec/expression/definitions/case.js +++ b/src/style-spec/expression/definitions/case.js @@ -64,7 +64,7 @@ class Case implements Expression { return this.otherwise.evaluate(ctx); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { for (const [test, expression] of this.branches) { fn(test); fn(expression); diff --git a/src/style-spec/expression/definitions/coalesce.js b/src/style-spec/expression/definitions/coalesce.js index db2137bd81c..82661c6acde 100644 --- a/src/style-spec/expression/definitions/coalesce.js +++ b/src/style-spec/expression/definitions/coalesce.js @@ -76,7 +76,7 @@ class Coalesce implements Expression { return result; } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { this.args.forEach(fn); } diff --git a/src/style-spec/expression/definitions/coercion.js b/src/style-spec/expression/definitions/coercion.js index 8f82185794f..cd4cd82df4a 100644 --- a/src/style-spec/expression/definitions/coercion.js +++ b/src/style-spec/expression/definitions/coercion.js @@ -108,7 +108,7 @@ class Coercion implements Expression { } } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { this.args.forEach(fn); } diff --git a/src/style-spec/expression/definitions/collator.js b/src/style-spec/expression/definitions/collator.js index 0dde79f2088..f97f4870506 100644 --- a/src/style-spec/expression/definitions/collator.js +++ b/src/style-spec/expression/definitions/collator.js @@ -50,7 +50,7 @@ export default class CollatorExpression implements Expression { return new Collator(this.caseSensitive.evaluate(ctx), this.diacriticSensitive.evaluate(ctx), this.locale ? this.locale.evaluate(ctx) : null); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.caseSensitive); fn(this.diacriticSensitive); if (this.locale) { diff --git a/src/style-spec/expression/definitions/comparison.js b/src/style-spec/expression/definitions/comparison.js index 89524278ffb..275b8be3a40 100644 --- a/src/style-spec/expression/definitions/comparison.js +++ b/src/style-spec/expression/definitions/comparison.js @@ -156,7 +156,7 @@ function makeComparison(op: ComparisonOperator, compareBasic, compareWithCollato compareBasic(ctx, lhs, rhs); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.lhs); fn(this.rhs); if (this.collator) { diff --git a/src/style-spec/expression/definitions/format.js b/src/style-spec/expression/definitions/format.js index 002cc8e41ab..ff14dbca986 100644 --- a/src/style-spec/expression/definitions/format.js +++ b/src/style-spec/expression/definitions/format.js @@ -102,7 +102,7 @@ export default class FormatExpression implements Expression { return new Formatted(this.sections.map(evaluateSection)); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { for (const section of this.sections) { fn(section.content); if (section.scale) { diff --git a/src/style-spec/expression/definitions/format_section_override.js b/src/style-spec/expression/definitions/format_section_override.js index 489389cbb03..58065e036e0 100644 --- a/src/style-spec/expression/definitions/format_section_override.js +++ b/src/style-spec/expression/definitions/format_section_override.js @@ -35,7 +35,7 @@ export default class FormatSectionOverride implements Expression { return this.defaultValue.property.specification.default; } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { if (!this.defaultValue.isConstant()) { const expr: ZoomConstantExpression<'source'> = ((this.defaultValue.value): any); fn(expr._styleExpression.expression); diff --git a/src/style-spec/expression/definitions/image.js b/src/style-spec/expression/definitions/image.js index c4fd9387ee5..6eb119ddd90 100644 --- a/src/style-spec/expression/definitions/image.js +++ b/src/style-spec/expression/definitions/image.js @@ -39,7 +39,7 @@ export default class ImageExpression implements Expression { return new ResolvedImage({name: evaluatedImageName, available}); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.input); } diff --git a/src/style-spec/expression/definitions/in.js b/src/style-spec/expression/definitions/in.js index f2fbac0224d..d4cb0af51bd 100644 --- a/src/style-spec/expression/definitions/in.js +++ b/src/style-spec/expression/definitions/in.js @@ -75,7 +75,7 @@ class In implements Expression { return haystack.indexOf(needle) >= 0; } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.needle); fn(this.haystack); } diff --git a/src/style-spec/expression/definitions/interpolate.js b/src/style-spec/expression/definitions/interpolate.js index 53c23d8d135..c2f9d5deaff 100644 --- a/src/style-spec/expression/definitions/interpolate.js +++ b/src/style-spec/expression/definitions/interpolate.js @@ -180,7 +180,7 @@ class Interpolate implements Expression { } } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.input); for (const expression of this.outputs) { fn(expression); diff --git a/src/style-spec/expression/definitions/length.js b/src/style-spec/expression/definitions/length.js index c06325d3b8a..1265822373f 100644 --- a/src/style-spec/expression/definitions/length.js +++ b/src/style-spec/expression/definitions/length.js @@ -43,7 +43,7 @@ class Length implements Expression { } } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.input); } diff --git a/src/style-spec/expression/definitions/let.js b/src/style-spec/expression/definitions/let.js index fc50cac8281..6b278de4ce3 100644 --- a/src/style-spec/expression/definitions/let.js +++ b/src/style-spec/expression/definitions/let.js @@ -20,7 +20,7 @@ class Let implements Expression { return this.result.evaluate(ctx); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { for (const binding of this.bindings) { fn(binding[1]); } diff --git a/src/style-spec/expression/definitions/match.js b/src/style-spec/expression/definitions/match.js index 9a3474ad4d0..a0fef3ff736 100644 --- a/src/style-spec/expression/definitions/match.js +++ b/src/style-spec/expression/definitions/match.js @@ -106,7 +106,7 @@ class Match implements Expression { return output.evaluate(ctx); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.input); this.outputs.forEach(fn); fn(this.otherwise); diff --git a/src/style-spec/expression/definitions/number_format.js b/src/style-spec/expression/definitions/number_format.js index 747c556ef9f..0caf5550314 100644 --- a/src/style-spec/expression/definitions/number_format.js +++ b/src/style-spec/expression/definitions/number_format.js @@ -103,7 +103,7 @@ export default class NumberFormat implements Expression { }).format(this.number.evaluate(ctx)); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.number); if (this.locale) { fn(this.locale); diff --git a/src/style-spec/expression/definitions/step.js b/src/style-spec/expression/definitions/step.js index a077ae364ee..c00bb9b99dd 100644 --- a/src/style-spec/expression/definitions/step.js +++ b/src/style-spec/expression/definitions/step.js @@ -95,7 +95,7 @@ class Step implements Expression { return outputs[index].evaluate(ctx); } - eachChild(fn: (Expression) => void) { + eachChild(fn: (_: Expression) => void) { fn(this.input); for (const expression of this.outputs) { fn(expression); diff --git a/src/style-spec/expression/evaluation_context.js b/src/style-spec/expression/evaluation_context.js index a3223a4bd29..82c801b3725 100644 --- a/src/style-spec/expression/evaluation_context.js +++ b/src/style-spec/expression/evaluation_context.js @@ -13,7 +13,7 @@ class EvaluationContext { formattedSection: ?FormattedSection; availableImages: ?Array; - _parseColorCache: {[string]: ?Color}; + _parseColorCache: {[_: string]: ?Color}; constructor() { this.globals = (null: any); diff --git a/src/style-spec/expression/expression.js b/src/style-spec/expression/expression.js index 662fccb509f..73a1329f977 100644 --- a/src/style-spec/expression/expression.js +++ b/src/style-spec/expression/expression.js @@ -26,4 +26,4 @@ export interface Expression { export type ExpressionParser = (args: $ReadOnlyArray, context: ParsingContext) => ?Expression; export type ExpressionRegistration = Class & { +parse: ExpressionParser }; -export type ExpressionRegistry = {[string]: ExpressionRegistration}; +export type ExpressionRegistry = {[_: string]: ExpressionRegistration}; diff --git a/src/style-spec/expression/index.js b/src/style-spec/expression/index.js index c100497a702..077baa855d4 100644 --- a/src/style-spec/expression/index.js +++ b/src/style-spec/expression/index.js @@ -29,17 +29,17 @@ import type {FormattedSection} from './types/formatted'; export type Feature = { +type: 1 | 2 | 3 | 'Unknown' | 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon', +id?: any, - +properties: {[string]: any}, - +patterns?: {[string]: {"min": string, "mid": string, "max": string}} + +properties: {[_: string]: any}, + +patterns?: {[_: string]: {"min": string, "mid": string, "max": string}} }; -export type FeatureState = {[string]: any}; +export type FeatureState = {[_: string]: any}; export type GlobalProperties = $ReadOnly<{ zoom: number, heatmapDensity?: number, lineProgress?: number, - isSupportedScript?: (string) => boolean, + isSupportedScript?: (_: string) => boolean, accumulated?: Value }>; @@ -49,7 +49,7 @@ export class StyleExpression { _evaluator: EvaluationContext; _defaultValue: Value; _warningHistory: {[key: string]: boolean}; - _enumValues: ?{[string]: any}; + _enumValues: ?{[_: string]: any}; constructor(expression: Expression, propertySpec: ?StylePropertySpecification) { this.expression = expression; diff --git a/src/style-spec/expression/scope.js b/src/style-spec/expression/scope.js index 15f35e2f5f0..b47e7cda5bd 100644 --- a/src/style-spec/expression/scope.js +++ b/src/style-spec/expression/scope.js @@ -8,7 +8,7 @@ import type {Expression} from './expression'; */ class Scope { parent: ?Scope; - bindings: {[string]: Expression}; + bindings: {[_: string]: Expression}; constructor(parent?: Scope, bindings: Array<[string, Expression]> = []) { this.parent = parent; this.bindings = {}; diff --git a/src/style-spec/feature_filter/convert.js b/src/style-spec/feature_filter/convert.js index 36bbee75a14..d7d473c2c4a 100644 --- a/src/style-spec/feature_filter/convert.js +++ b/src/style-spec/feature_filter/convert.js @@ -4,7 +4,7 @@ import {isExpressionFilter} from './index'; import type {FilterSpecification} from '../types'; -type ExpectedTypes = {[string]: 'string' | 'number' | 'boolean'}; +type ExpectedTypes = {[_: string]: 'string' | 'number' | 'boolean'}; /** * Convert the given legacy filter to (the JSON representation of) an diff --git a/src/style-spec/style-spec.js b/src/style-spec/style-spec.js index 10d9b423cbd..66e039f9fc7 100644 --- a/src/style-spec/style-spec.js +++ b/src/style-spec/style-spec.js @@ -31,7 +31,7 @@ export type StylePropertySpecification = { type: 'enum', 'property-type': ExpressionType, expression?: ExpressionSpecification, - values: {[string]: {}}, + values: {[_: string]: {}}, transition: boolean, default?: string } | { diff --git a/src/style-spec/types.js b/src/style-spec/types.js index ecfab1078b5..94b42bd1c2b 100644 --- a/src/style-spec/types.js +++ b/src/style-spec/types.js @@ -8,7 +8,7 @@ export type FormattedSpecification = string; export type ResolvedImageSpecification = string; -export type PromoteIdSpecification = {[string]: string} | string; +export type PromoteIdSpecification = {[_: string]: string} | string; export type FilterSpecification = | ['has', string] @@ -66,7 +66,7 @@ export type StyleSpecification = {| "bearing"?: number, "pitch"?: number, "light"?: LightSpecification, - "sources": {[string]: SourceSpecification}, + "sources": {[_: string]: SourceSpecification}, "sprite"?: string, "glyphs"?: string, "transition"?: TransitionSpecification, diff --git a/src/style-spec/visit.js b/src/style-spec/visit.js index 42fdb07552f..2911c1f0362 100644 --- a/src/style-spec/visit.js +++ b/src/style-spec/visit.js @@ -25,13 +25,13 @@ function getPropertyReference(propertyName): StylePropertySpecification { return (null: any); } -export function eachSource(style: StyleSpecification, callback: (SourceSpecification) => void) { +export function eachSource(style: StyleSpecification, callback: (_: SourceSpecification) => void) { for (const k in style.sources) { callback(style.sources[k]); } } -export function eachLayer(style: StyleSpecification, callback: (LayerSpecification) => void) { +export function eachLayer(style: StyleSpecification, callback: (_: LayerSpecification) => void) { for (const layer of style.layers) { callback(layer); } diff --git a/src/style/load_glyph_range.js b/src/style/load_glyph_range.js index 7cd6c589cbd..d57efd6f029 100644 --- a/src/style/load_glyph_range.js +++ b/src/style/load_glyph_range.js @@ -12,7 +12,7 @@ export default function (fontstack: string, range: number, urlTemplate: string, requestManager: RequestManager, - callback: Callback<{[number]: StyleGlyph | null}>) { + callback: Callback<{[_: number]: StyleGlyph | null}>) { const begin = range * 256; const end = begin + 255; diff --git a/src/style/load_sprite.js b/src/style/load_sprite.js index 6e8a65443fb..2f166ca0c0b 100644 --- a/src/style/load_sprite.js +++ b/src/style/load_sprite.js @@ -12,7 +12,7 @@ import type {Cancelable} from '../types/cancelable'; export default function(baseURL: string, requestManager: RequestManager, - callback: Callback<{[string]: StyleImage}>): Cancelable { + callback: Callback<{[_: string]: StyleImage}>): Cancelable { let json: any, image, error; const format = browser.devicePixelRatio > 1 ? '@2x' : ''; diff --git a/src/style/pauseable_placement.js b/src/style/pauseable_placement.js index 39e52ef55f9..d443ad6aea5 100644 --- a/src/style/pauseable_placement.js +++ b/src/style/pauseable_placement.js @@ -85,7 +85,7 @@ class PauseablePlacement { return this._done; } - continuePlacement(order: Array, layers: {[string]: StyleLayer}, layerTiles: {[string]: Array}) { + continuePlacement(order: Array, layers: {[_: string]: StyleLayer}, layerTiles: {[_: string]: Array}) { const startTime = browser.now(); const shouldPausePlacement = () => { diff --git a/src/style/style.js b/src/style/style.js index d4f99622276..02bbf786ee1 100644 --- a/src/style/style.js +++ b/src/style/style.js @@ -113,17 +113,17 @@ class Style extends Evented { _request: ?Cancelable; _spriteRequest: ?Cancelable; - _layers: {[string]: StyleLayer}; + _layers: {[_: string]: StyleLayer}; _order: Array; - sourceCaches: {[string]: SourceCache}; + sourceCaches: {[_: string]: SourceCache}; zoomHistory: ZoomHistory; _loaded: boolean; _rtlTextPluginCallback: Function; _changed: boolean; - _updatedSources: {[string]: 'clear' | 'reload'}; - _updatedLayers: {[string]: true}; - _removedLayers: {[string]: StyleLayer}; - _changedImages: {[string]: true}; + _updatedSources: {[_: string]: 'clear' | 'reload'}; + _updatedLayers: {[_: string]: true}; + _removedLayers: {[_: string]: StyleLayer}; + _changedImages: {[_: string]: true}; _updatedPaintProps: {[layer: string]: true}; _layerOrderChanged: boolean; @@ -1307,7 +1307,7 @@ class Style extends Evented { // Callbacks from web workers - getImages(mapId: string, params: {icons: Array, source: string, tileID: OverscaledTileID, type: string}, callback: Callback<{[string]: StyleImage}>) { + getImages(mapId: string, params: {icons: Array, source: string, tileID: OverscaledTileID, type: string}, callback: Callback<{[_: string]: StyleImage}>) { this.imageManager.getImages(params.icons, callback); @@ -1327,7 +1327,7 @@ class Style extends Evented { } } - getGlyphs(mapId: string, params: {stacks: {[string]: Array}}, callback: Callback<{[string]: {[number]: ?StyleGlyph}}>) { + getGlyphs(mapId: string, params: {stacks: {[_: string]: Array}}, callback: Callback<{[_: string]: {[_: number]: ?StyleGlyph}}>) { this.glyphManager.getGlyphs(params.stacks, callback); } diff --git a/src/style/style_layer_index.js b/src/style/style_layer_index.js index 393fb33299b..555c0993dcd 100644 --- a/src/style/style_layer_index.js +++ b/src/style/style_layer_index.js @@ -10,7 +10,7 @@ import groupByLayout from '../style-spec/group_by_layout'; import type {TypedStyleLayer} from './style_layer/typed_style_layer'; import type {LayerSpecification} from '../style-spec/types'; -export type LayerConfigs = { [string]: LayerSpecification }; +export type LayerConfigs = {[_: string]: LayerSpecification }; export type Family = Array; class StyleLayerIndex { @@ -18,7 +18,7 @@ class StyleLayerIndex { keyCache: { [source: string]: string }; _layerConfigs: LayerConfigs; - _layers: { [string]: StyleLayer }; + _layers: {[_: string]: StyleLayer }; constructor(layerConfigs: ?Array) { this.keyCache = {}; diff --git a/src/symbol/cross_tile_symbol_index.js b/src/symbol/cross_tile_symbol_index.js index 75b0508c0e2..103d8399612 100644 --- a/src/symbol/cross_tile_symbol_index.js +++ b/src/symbol/cross_tile_symbol_index.js @@ -29,7 +29,7 @@ const roundingFactor = 512 / EXTENT / 2; class TileLayerIndex { tileID: OverscaledTileID; - indexedSymbolInstances: {[number]: Array<{ + indexedSymbolInstances: {[_: number]: Array<{ crossTileID: number, coord: { x: number, @@ -243,7 +243,7 @@ class CrossTileSymbolIndex { layerIndexes: {[layerId: string]: CrossTileSymbolLayerIndex}; crossTileIDs: CrossTileIDs; maxBucketInstanceId: number; - bucketsInCurrentPlacement: {[number]: boolean}; + bucketsInCurrentPlacement: {[_: number]: boolean}; constructor() { this.layerIndexes = {}; diff --git a/src/symbol/mergelines.js b/src/symbol/mergelines.js index ebd0607f20a..34b5d383495 100644 --- a/src/symbol/mergelines.js +++ b/src/symbol/mergelines.js @@ -3,8 +3,8 @@ import type {SymbolFeature} from '../data/bucket/symbol_bucket'; export default function (features: Array): Array { - const leftIndex: {[string]: number} = {}; - const rightIndex: {[string]: number} = {}; + const leftIndex: {[_: string]: number} = {}; + const rightIndex: {[_: string]: number} = {}; const mergedFeatures = []; let mergedIndex = 0; diff --git a/src/symbol/placement.js b/src/symbol/placement.js index 2f949138510..cb3eda53511 100644 --- a/src/symbol/placement.js +++ b/src/symbol/placement.js @@ -182,16 +182,16 @@ export type CrossTileID = string | number; export class Placement { transform: Transform; collisionIndex: CollisionIndex; - placements: { [CrossTileID]: JointPlacement }; - opacities: { [CrossTileID]: JointOpacityState }; - variableOffsets: {[CrossTileID]: VariableOffset }; - placedOrientations: {[CrossTileID]: number }; + placements: { [_: CrossTileID]: JointPlacement }; + opacities: { [_: CrossTileID]: JointOpacityState }; + variableOffsets: {[_: CrossTileID]: VariableOffset }; + placedOrientations: {[_: CrossTileID]: number }; commitTime: number; prevZoomAdjustment: number; lastPlacementChangeTime: number; stale: boolean; fadeDuration: number; - retainedQueryData: {[number]: RetainedQueryData}; + retainedQueryData: {[_: number]: RetainedQueryData}; collisionGroups: CollisionGroups; prevPlacement: ?Placement; zoomAtLastRecencyCheck: number; diff --git a/src/symbol/projection.js b/src/symbol/projection.js index 894e7ff345f..406989fc859 100644 --- a/src/symbol/projection.js +++ b/src/symbol/projection.js @@ -343,7 +343,7 @@ function placeGlyphAlongLine(offsetX: number, lineEndIndex: number, lineVertexArray: SymbolLineVertexArray, labelPlaneMatrix: mat4, - projectionCache: {[number]: Point}, + projectionCache: {[_: number]: Point}, returnTileDistance: boolean) { const combinedOffsetX = flip ? diff --git a/src/symbol/quads.js b/src/symbol/quads.js index 83b54106f99..9b1c100620e 100644 --- a/src/symbol/quads.js +++ b/src/symbol/quads.js @@ -225,7 +225,7 @@ export function getGlyphQuads(anchor: Anchor, layer: SymbolStyleLayer, alongLine: boolean, feature: Feature, - imageMap: {[string]: StyleImage}, + imageMap: {[_: string]: StyleImage}, allowVerticalPlacement: boolean): Array { const textRotate = layer.layout.get('text-rotate').evaluate(feature, {}) * Math.PI / 180; diff --git a/src/symbol/shaping.js b/src/symbol/shaping.js index 06a63c8fde8..dafdd6ecfac 100644 --- a/src/symbol/shaping.js +++ b/src/symbol/shaping.js @@ -237,9 +237,9 @@ function breakLines(input: TaggedString, lineBreakPoints: Array): Array< } function shapeText(text: Formatted, - glyphMap: {[string]: {[number]: ?StyleGlyph}}, - glyphPositions: {[string]: {[number]: GlyphPosition}}, - imagePositions: {[string]: ImagePosition}, + glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}}, + glyphPositions: {[_: string]: {[_: number]: GlyphPosition}}, + imagePositions: {[_: string]: ImagePosition}, defaultFontStack: string, maxWidth: number, lineHeight: number, @@ -317,7 +317,7 @@ function shapeText(text: Formatted, // using computed properties due to https://github.com/facebook/flow/issues/380 /* eslint no-useless-computed-key: 0 */ -const whitespace: {[number]: boolean} = { +const whitespace: {[_: number]: boolean} = { [0x09]: true, // tab [0x0a]: true, // newline [0x0b]: true, // vertical tab @@ -326,7 +326,7 @@ const whitespace: {[number]: boolean} = { [0x20]: true, // space }; -const breakable: {[number]: boolean} = { +const breakable: {[_: number]: boolean} = { [0x0a]: true, // newline [0x20]: true, // space [0x26]: true, // ampersand @@ -348,8 +348,8 @@ const breakable: {[number]: boolean} = { function getGlyphAdvance(codePoint: number, section: SectionOptions, - glyphMap: {[string]: {[number]: ?StyleGlyph}}, - imagePositions: {[string]: ImagePosition}, + glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}}, + imagePositions: {[_: string]: ImagePosition}, spacing: number, layoutTextSize: number): number { if (!section.imageName) { @@ -367,8 +367,8 @@ function getGlyphAdvance(codePoint: number, function determineAverageLineWidth(logicalInput: TaggedString, spacing: number, maxWidth: number, - glyphMap: {[string]: {[number]: ?StyleGlyph}}, - imagePositions: {[string]: ImagePosition}, + glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}}, + imagePositions: {[_: string]: ImagePosition}, layoutTextSize: number) { let totalWidth = 0; @@ -471,8 +471,8 @@ function leastBadBreaks(lastLineBreak: ?Break): Array { function determineLineBreaks(logicalInput: TaggedString, spacing: number, maxWidth: number, - glyphMap: {[string]: {[number]: ?StyleGlyph}}, - imagePositions: {[string]: ImagePosition}, + glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}}, + imagePositions: {[_: string]: ImagePosition}, symbolPlacement: string, layoutTextSize: number): Array { if (symbolPlacement !== 'point') @@ -554,9 +554,9 @@ function getAnchorAlignment(anchor: SymbolAnchor) { } function shapeLines(shaping: Shaping, - glyphMap: {[string]: {[number]: ?StyleGlyph}}, - glyphPositions: {[string]: {[number]: GlyphPosition}}, - imagePositions: {[string]: ImagePosition}, + glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}}, + glyphPositions: {[_: string]: {[_: number]: GlyphPosition}}, + imagePositions: {[_: string]: ImagePosition}, lines: Array, lineHeight: number, textAnchor: SymbolAnchor, diff --git a/src/symbol/symbol_layout.js b/src/symbol/symbol_layout.js index e6b6e8eb2b4..d4f38bcc037 100644 --- a/src/symbol/symbol_layout.js +++ b/src/symbol/symbol_layout.js @@ -148,10 +148,10 @@ export function evaluateVariableOffset(anchor: TextAnchor, offset: [number, numb } export function performSymbolLayout(bucket: SymbolBucket, - glyphMap: {[string]: {[number]: ?StyleGlyph}}, - glyphPositions: {[string]: {[number]: GlyphPosition}}, - imageMap: {[string]: StyleImage}, - imagePositions: {[string]: ImagePosition}, + glyphMap: {[_: string]: {[_: number]: ?StyleGlyph}}, + glyphPositions: {[_: string]: {[_: number]: GlyphPosition}}, + imageMap: {[_: string]: StyleImage}, + imagePositions: {[_: string]: ImagePosition}, showCollisionBoxes: boolean) { bucket.createArrays(); @@ -351,7 +351,7 @@ function addFeature(bucket: SymbolBucket, feature: SymbolFeature, shapedTextOrientations: any, shapedIcon: PositionedIcon | void, - imageMap: {[string]: StyleImage}, + imageMap: {[_: string]: StyleImage}, sizes: Sizes, layoutTextSize: number, layoutIconSize: number, @@ -476,7 +476,7 @@ export {MAX_PACKED_SIZE}; function addTextVertices(bucket: SymbolBucket, anchor: Point, shapedText: Shaping, - imageMap: {[string]: StyleImage}, + imageMap: {[_: string]: StyleImage}, layer: SymbolStyleLayer, textAlongLine: boolean, feature: SymbolFeature, @@ -484,7 +484,7 @@ function addTextVertices(bucket: SymbolBucket, lineArray: {lineStartIndex: number, lineLength: number}, writingMode: number, placementTypes: Array<'vertical' | 'center' | 'left' | 'right'>, - placedTextSymbolIndices: {[string]: number}, + placedTextSymbolIndices: {[_: string]: number}, placedIconIndex: number, sizes: Sizes) { const glyphQuads = getGlyphQuads(anchor, shapedText, textOffset, @@ -526,7 +526,7 @@ function addTextVertices(bucket: SymbolBucket, return glyphQuads.length * 4; } -function getDefaultHorizontalShaping(horizontalShaping: {[TextJustify]: Shaping}): Shaping | null { +function getDefaultHorizontalShaping(horizontalShaping: {[_: TextJustify]: Shaping}): Shaping | null { // We don't care which shaping we get because this is used for collision purposes // and all the justifications have the same collision box for (const justification: any in horizontalShaping) { @@ -545,7 +545,7 @@ function addSymbol(bucket: SymbolBucket, line: Array, shapedTextOrientations: any, shapedIcon: PositionedIcon | void, - imageMap: {[string]: StyleImage}, + imageMap: {[_: string]: StyleImage}, verticallyShapedIcon: PositionedIcon | void, layer: SymbolStyleLayer, collisionBoxArray: CollisionBoxArray, diff --git a/src/ui/anchor.js b/src/ui/anchor.js index 249474aeb06..78b2bc2b99f 100644 --- a/src/ui/anchor.js +++ b/src/ui/anchor.js @@ -11,7 +11,7 @@ export type Anchor = | 'bottom-left' | 'bottom-right'; -export const anchorTranslate: {[Anchor]: string} = { +export const anchorTranslate: {[_: Anchor]: string} = { 'center': 'translate(-50%,-50%)', 'top': 'translate(-50%,0)', 'top-left': 'translate(0,0)', diff --git a/src/ui/camera.js b/src/ui/camera.js index 8b953e439ab..759c8d7d3ef 100644 --- a/src/ui/camera.js +++ b/src/ui/camera.js @@ -62,7 +62,7 @@ export type CameraOptions = { */ export type AnimationOptions = { duration?: number, - easing?: (number) => number, + easing?: (_: number) => number, offset?: PointLike, animate?: boolean, essential?: boolean @@ -90,14 +90,14 @@ class Camera extends Evented { _bearingSnap: number; _easeEndTimeoutID: TimeoutID; _easeStart: number; - _easeOptions: {duration: number, easing: (number) => number}; + _easeOptions: {duration: number, easing: (_: number) => number}; - _onEaseFrame: (number) => void; + _onEaseFrame: (_: number) => void; _onEaseEnd: () => void; _easeFrameId: ?TaskID; +_requestRenderFrame: (() => void) => TaskID; - +_cancelRenderFrame: (TaskID) => void; + +_cancelRenderFrame: (_: TaskID) => void; constructor(transform: Transform, options: {bearingSnap: number}) { super(); @@ -993,13 +993,13 @@ class Camera extends Evented { // w(s): Returns the visible span on the ground, measured in pixels with respect to the // initial scale. Assumes an angular field of view of 2 arctan ½ ≈ 53°. - let w: (number) => number = function (s) { + let w: (_: number) => number = function (s) { return (cosh(r0) / cosh(r0 + rho * s)); }; // u(s): Returns the distance along the flight path as projected onto the ground plane, // measured in pixels from the world image origin at the initial scale. - let u: (number) => number = function (s) { + let u: (_: number) => number = function (s) { return w0 * ((cosh(r0) * tanh(r0 + rho * s) - sinh(r0)) / rho2) / u1; }; @@ -1093,9 +1093,9 @@ class Camera extends Evented { return this; } - _ease(frame: (number) => void, + _ease(frame: (_: number) => void, finish: () => void, - options: {animate: boolean, duration: number, easing: (number) => number}) { + options: {animate: boolean, duration: number, easing: (_: number) => number}) { if (options.animate === false || options.duration === 0) { frame(1); finish(); diff --git a/src/ui/handler/scroll_zoom.js b/src/ui/handler/scroll_zoom.js index 6e93ca0db3a..cc17cd3dc65 100644 --- a/src/ui/handler/scroll_zoom.js +++ b/src/ui/handler/scroll_zoom.js @@ -50,7 +50,7 @@ class ScrollZoomHandler { _targetZoom: ?number; _delta: number; _easing: ?((number) => number); - _prevEase: ?{start: number, duration: number, easing: (number) => number}; + _prevEase: ?{start: number, duration: number, easing: (_: number) => number}; _frameId: ?TaskID; diff --git a/src/ui/map.js b/src/ui/map.js index 95aa7c814ac..f7278224f72 100755 --- a/src/ui/map.js +++ b/src/ui/map.js @@ -267,7 +267,7 @@ class Map extends Camera { _missingCSSCanary: HTMLElement; _canvasContainer: HTMLElement; _controlContainer: HTMLElement; - _controlPositions: {[string]: HTMLElement}; + _controlPositions: {[_: string]: HTMLElement}; _interactive: ?boolean; _showTileBoundaries: ?boolean; _showCollisionBoxes: ?boolean; diff --git a/src/ui/popup.js b/src/ui/popup.js index 6f415c69cd4..ac48b592fab 100644 --- a/src/ui/popup.js +++ b/src/ui/popup.js @@ -20,7 +20,7 @@ const defaultOptions = { maxWidth: "240px" }; -export type Offset = number | PointLike | {[Anchor]: PointLike}; +export type Offset = number | PointLike | {[_: Anchor]: PointLike}; export type PopupOptions = { closeButton?: boolean, diff --git a/src/util/dictionary_coder.js b/src/util/dictionary_coder.js index 9dc914f43b2..320eb3548f8 100644 --- a/src/util/dictionary_coder.js +++ b/src/util/dictionary_coder.js @@ -3,7 +3,7 @@ import assert from 'assert'; class DictionaryCoder { - _stringToNumber: { [string]: number }; + _stringToNumber: {[_: string]: number }; _numberToString: Array; constructor(strings: Array) { diff --git a/src/util/evented.js b/src/util/evented.js index b75a53be5c5..de05d109219 100644 --- a/src/util/evented.js +++ b/src/util/evented.js @@ -3,7 +3,7 @@ import {extend} from './util'; type Listener = (Object) => any; -type Listeners = { [string]: Array }; +type Listeners = {[_: string]: Array }; function _addEventListener(type: string, listener: Listener, listenerList: Listeners) { const listenerExists = listenerList[type] && listenerList[type].indexOf(listener) !== -1; diff --git a/src/util/mapbox.js b/src/util/mapbox.js index 0552a1ba6ef..cc4c867f797 100644 --- a/src/util/mapbox.js +++ b/src/util/mapbox.js @@ -332,7 +332,7 @@ class TelemetryEvent { * to the values that should be saved. For this reason, the callback should be invoked prior to the call * to TelemetryEvent#saveData */ - postEvent(timestamp: number, additionalPayload: {[string]: any}, callback: (err: ?Error) => void, customAccessToken?: ?string) { + postEvent(timestamp: number, additionalPayload: {[_: string]: any}, callback: (err: ?Error) => void, customAccessToken?: ?string) { if (!config.EVENTS_URL) return; const eventsUrlObject: UrlObject = parseUrl(config.EVENTS_URL); eventsUrlObject.params.push(`access_token=${customAccessToken || config.ACCESS_TOKEN || ''}`); @@ -370,7 +370,7 @@ class TelemetryEvent { } export class MapLoadEvent extends TelemetryEvent { - +success: {[number]: boolean}; + +success: {[_: number]: boolean}; skuToken: string; constructor() { diff --git a/src/util/web_worker.js b/src/util/web_worker.js index 3b70934c628..858a2e2f307 100644 --- a/src/util/web_worker.js +++ b/src/util/web_worker.js @@ -25,7 +25,7 @@ export interface WorkerGlobalScopeInterface { importScripts(...urls: Array): void; registerWorkerSource: (string, Class) => void, - registerRTLTextPlugin: (any) => void + registerRTLTextPlugin: (_: any) => void } class MessageBus implements WorkerInterface, WorkerGlobalScopeInterface { diff --git a/src/util/web_worker_transfer.js b/src/util/web_worker_transfer.js index 3ef2f74a2dc..a3625eccc42 100644 --- a/src/util/web_worker_transfer.js +++ b/src/util/web_worker_transfer.js @@ -13,7 +13,7 @@ const {ImageData, ImageBitmap} = window; import type {Transferable} from '../types/transferable'; -type SerializedObject = { [string]: Serialized }; // eslint-disable-line +type SerializedObject = {[_: string]: Serialized }; // eslint-disable-line export type Serialized = | null | void @@ -32,7 +32,7 @@ export type Serialized = | SerializedObject; type Registry = { - [string]: { + [_: string]: { klass: Class, omit: $ReadOnlyArray, shallow: $ReadOnlyArray diff --git a/src/util/worker_pool.js b/src/util/worker_pool.js index 734f886e23a..98872a62f6c 100644 --- a/src/util/worker_pool.js +++ b/src/util/worker_pool.js @@ -11,7 +11,7 @@ import browser from './browser'; export default class WorkerPool { static workerCount: number; - active: {[number]: boolean}; + active: {[_: number]: boolean}; workers: Array; constructor() {