From 35b89cbe15b7fcb9c141b2b9b79e7eed3113bc67 Mon Sep 17 00:00:00 2001
From: Paul Vaneveld
Date: Wed, 29 Jan 2025 16:19:45 +0100
Subject: [PATCH] fix: filter empty options instead of adding
* prevents adding an empty string that doesn't exist in the actual options
---
src/index.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/index.ts b/src/index.ts
index 5813b69..bdd56a8 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -222,8 +222,8 @@ export default async function storyblokToTypescript({
options = element.options.map(item => item.value);
}
- if (options.length && element.exclude_empty_option !== true) {
- options.unshift('')
+ if (options.length && element.exclude_empty_option === true) {
+ options = options.filter(option => option !== "")
}
// option types with source self do not have a source field but the options as array