From 4355a974a3b49389a31b51aecea45ef8b0b8db7e Mon Sep 17 00:00:00 2001 From: Danny Koppenhagen Date: Sun, 21 Jan 2024 07:22:53 +0100 Subject: [PATCH] feat(ol/feature): allow generics for `feature.getProperties()` with this change it's possible to pass a generic type `T` when calling `feature.getProperties()` and using with TypeScript. ``` // before: const stop = feature?.getProperties() as Stop const stop = feature?.getProperties() console.log(typeof stop) // "Stop" ``` closes #14868 --- src/ol/render/Feature.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ol/render/Feature.js b/src/ol/render/Feature.js index 62ed6f08f38..838009dac44 100644 --- a/src/ol/render/Feature.js +++ b/src/ol/render/Feature.js @@ -282,10 +282,12 @@ class RenderFeature { /** * Get the feature properties. - * @return {Object} Feature properties. + * @template {Object} T = An optional generic type of the requested feature properties + * @return {T} Feature properties. * @api */ getProperties() { + // @ts-ignore (= this.properties_ as T) return this.properties_; }