Skip to content

Commit

Permalink
[Maps] fix IVectorLayer.getStyle typing (#75829)
Browse files Browse the repository at this point in the history
* [Maps] fix IVectorLayer.getStyle typing

* update typing in VectorLayer type definition

* fix unit tests

* review feedback
  • Loading branch information
nreese authored Aug 25, 2020
1 parent 9511285 commit 947a939
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export interface IVectorLayer extends ILayer {
getJoins(): IJoin[];
getValidJoins(): IJoin[];
getSource(): IVectorSource;
getStyle(): IVectorStyle;
getFeatureById(id: string | number): Feature | null;
getPropertiesForTooltip(properties: GeoJsonProperties): Promise<ITooltipProperty[]>;
hasJoins(): boolean;
Expand Down Expand Up @@ -79,7 +78,6 @@ export class VectorLayer extends AbstractLayer implements IVectorLayer {
_setMbPointsProperties(mbMap: unknown, mvtSourceLayer?: string): void;
_setMbLinePolygonProperties(mbMap: unknown, mvtSourceLayer?: string): void;
getSource(): IVectorSource;
getStyle(): IVectorStyle;
getFeatureById(id: string | number): Feature | null;
getPropertiesForTooltip(properties: GeoJsonProperties): Promise<ITooltipProperty[]>;
hasJoins(): boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

// eslint-disable-next-line max-classes-per-file
import { FIELD_ORIGIN } from '../../../../../../common/constants';
import { FIELD_ORIGIN, LAYER_STYLE_TYPE } from '../../../../../../common/constants';
import { StyleMeta } from '../../style_meta';
import {
CategoryFieldMeta,
Expand Down Expand Up @@ -44,7 +44,7 @@ export class MockStyle implements IStyle {
}

getType() {
return 'mockStyle';
return LAYER_STYLE_TYPE.VECTOR;
}

getStyleMeta(): StyleMeta {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
import { IField } from '../../../fields/field';
import { IVectorLayer } from '../../../layers/vector_layer/vector_layer';
import { IJoin } from '../../../joins/join';
import { IVectorStyle } from '../vector_style';

export interface IDynamicStyleProperty<T> extends IStyleProperty<T> {
getFieldMetaOptions(): FieldMetaOptions;
Expand Down Expand Up @@ -88,7 +89,7 @@ export class DynamicStyleProperty<T> extends AbstractStyleProperty<T>
}

getRangeFieldMeta() {
const style = this._layer.getStyle();
const style = this._layer.getStyle() as IVectorStyle;
const styleMeta = style.getStyleMeta();
const fieldName = this.getFieldName();
const rangeFieldMetaFromLocalFeatures = styleMeta.getRangeFieldMetaDescriptor(fieldName);
Expand All @@ -113,7 +114,7 @@ export class DynamicStyleProperty<T> extends AbstractStyleProperty<T>
}

getCategoryFieldMeta() {
const style = this._layer.getStyle();
const style = this._layer.getStyle() as IVectorStyle;
const styleMeta = style.getStyleMeta();
const fieldName = this.getFieldName();
const categoryFieldMetaFromLocalFeatures = styleMeta.getCategoryFieldMetaDescriptor(fieldName);
Expand Down

0 comments on commit 947a939

Please sign in to comment.