Skip to content

Commit 947a939

Browse files
authored
[Maps] fix IVectorLayer.getStyle typing (#75829)
* [Maps] fix IVectorLayer.getStyle typing * update typing in VectorLayer type definition * fix unit tests * review feedback
1 parent 9511285 commit 947a939

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

x-pack/plugins/maps/public/classes/layers/vector_layer/vector_layer.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export interface IVectorLayer extends ILayer {
3232
getJoins(): IJoin[];
3333
getValidJoins(): IJoin[];
3434
getSource(): IVectorSource;
35-
getStyle(): IVectorStyle;
3635
getFeatureById(id: string | number): Feature | null;
3736
getPropertiesForTooltip(properties: GeoJsonProperties): Promise<ITooltipProperty[]>;
3837
hasJoins(): boolean;
@@ -79,7 +78,6 @@ export class VectorLayer extends AbstractLayer implements IVectorLayer {
7978
_setMbPointsProperties(mbMap: unknown, mvtSourceLayer?: string): void;
8079
_setMbLinePolygonProperties(mbMap: unknown, mvtSourceLayer?: string): void;
8180
getSource(): IVectorSource;
82-
getStyle(): IVectorStyle;
8381
getFeatureById(id: string | number): Feature | null;
8482
getPropertiesForTooltip(properties: GeoJsonProperties): Promise<ITooltipProperty[]>;
8583
hasJoins(): boolean;

x-pack/plugins/maps/public/classes/styles/vector/properties/__tests__/test_util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66

77
// eslint-disable-next-line max-classes-per-file
8-
import { FIELD_ORIGIN } from '../../../../../../common/constants';
8+
import { FIELD_ORIGIN, LAYER_STYLE_TYPE } from '../../../../../../common/constants';
99
import { StyleMeta } from '../../style_meta';
1010
import {
1111
CategoryFieldMeta,
@@ -44,7 +44,7 @@ export class MockStyle implements IStyle {
4444
}
4545

4646
getType() {
47-
return 'mockStyle';
47+
return LAYER_STYLE_TYPE.VECTOR;
4848
}
4949

5050
getStyleMeta(): StyleMeta {

x-pack/plugins/maps/public/classes/styles/vector/properties/dynamic_style_property.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
import { IField } from '../../../fields/field';
2828
import { IVectorLayer } from '../../../layers/vector_layer/vector_layer';
2929
import { IJoin } from '../../../joins/join';
30+
import { IVectorStyle } from '../vector_style';
3031

3132
export interface IDynamicStyleProperty<T> extends IStyleProperty<T> {
3233
getFieldMetaOptions(): FieldMetaOptions;
@@ -88,7 +89,7 @@ export class DynamicStyleProperty<T> extends AbstractStyleProperty<T>
8889
}
8990

9091
getRangeFieldMeta() {
91-
const style = this._layer.getStyle();
92+
const style = this._layer.getStyle() as IVectorStyle;
9293
const styleMeta = style.getStyleMeta();
9394
const fieldName = this.getFieldName();
9495
const rangeFieldMetaFromLocalFeatures = styleMeta.getRangeFieldMetaDescriptor(fieldName);
@@ -113,7 +114,7 @@ export class DynamicStyleProperty<T> extends AbstractStyleProperty<T>
113114
}
114115

115116
getCategoryFieldMeta() {
116-
const style = this._layer.getStyle();
117+
const style = this._layer.getStyle() as IVectorStyle;
117118
const styleMeta = style.getStyleMeta();
118119
const fieldName = this.getFieldName();
119120
const categoryFieldMetaFromLocalFeatures = styleMeta.getCategoryFieldMetaDescriptor(fieldName);

0 commit comments

Comments
 (0)