From 589666cc2b65fc884d66fed78f34ac05cf7b33b8 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Thu, 16 Aug 2018 11:48:03 +0200 Subject: [PATCH] Accept null styles When a style is null, OpenLayers does not render the associated feature. --- types/openlayers/index.d.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index 37cac7e65d..70af9ba081 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -1715,7 +1715,7 @@ export class Feature extends Object { * representing the current style of this feature. * @api stable */ - getStyleFunction(): (ol.FeatureStyleFunction); + getStyleFunction(): (ol.FeatureStyleFunction | undefined); /** * Set the default geometry for the feature. This will update the property @@ -6412,7 +6412,7 @@ export namespace layer { * @return Layer style function. * @api stable */ - getStyleFunction(): (ol.StyleFunction); + getStyleFunction(): (ol.StyleFunction | undefined); /** * Set the style for features. This can be a single style object, an array @@ -6424,7 +6424,7 @@ export namespace layer { * @param style Layer style. * @api stable */ - setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null)): void; + setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void; } /** @@ -8472,7 +8472,7 @@ export namespace source { * @return Layer style function. * @api stable */ - getStyleFunction(): (ol.StyleFunction); + getStyleFunction(): (ol.StyleFunction | undefined); /** * Set the style for features. This can be a single style object, an array @@ -8484,7 +8484,7 @@ export namespace source { * @param style Layer style. * @api stable */ - setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction)): void; + setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void; } /** @@ -10831,7 +10831,7 @@ export type FeatureLoader = (extent: ol.Extent, resolution: number, proj: ol.pro * {@link ol.Feature} to be styled. * */ -export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[]); +export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[] | null); /** * {@link ol.source.Vector} sources use a function of this type to get the url @@ -10981,7 +10981,7 @@ export interface StyleImageOptions { * or an array of them. This way e.g. a vector layer can be styled. * */ -export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[]); +export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[] | null); /** * A function that takes an {@link ol.Feature} as argument and returns an