More type fixes

AW-4620
Willem Dantuma 2021-10-05 14:08:55 +02:00
parent 160eb10aba
commit 5d21d66589
2 changed files with 4 additions and 4 deletions

View File

@ -57,7 +57,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
getSelectedStyle(feature:Feature<Geometry>):style.Style { getSelectedStyle(feature:Feature<Geometry>):style.Style {
let key = feature.get('itemType')+"_selected"; let key = feature.get('itemType')+"_selected";
let evaluatedStyle: style.Style | (Feature<Geometry>) =undefined; let evaluatedStyle: style.Style =undefined;
var styleEntry = this.stylesCache[key]; var styleEntry = this.stylesCache[key];
if(styleEntry) { if(styleEntry) {
if(typeof styleEntry === 'function') { if(typeof styleEntry === 'function') {
@ -66,10 +66,10 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
evaluatedStyle = styleEntry; evaluatedStyle = styleEntry;
} }
} else { } else {
evaluatedStyle = this.stylesCache["selected"]; evaluatedStyle = this.stylesCache["selected"] as style.Style;
} }
if(evaluatedStyle ) { if(evaluatedStyle ) {
evaluatedStyle.setGeometry((feature) => this.geometry(feature)); evaluatedStyle .setGeometry((feature:Feature<Geometry>) => this.geometry(feature));
} }
return evaluatedStyle as style.Style return evaluatedStyle as style.Style
} }

View File

@ -3,5 +3,5 @@ import { Style } from 'ol/style';
import {Geometry } from 'ol/geom'; import {Geometry } from 'ol/geom';
export interface IStyles{ export interface IStyles{
[id: string]: Style | (Feature<Geometry>); [id: string]: Style | ((featue:Feature<Geometry>) => Style);
}; };