Skip to content

Commit 35b89cb

Browse files
committed
fix: filter empty options instead of adding
* prevents adding an empty string that doesn't exist in the actual options
1 parent e9a1f67 commit 35b89cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ export default async function storyblokToTypescript({
222222
options = element.options.map(item => item.value);
223223
}
224224

225-
if (options.length && element.exclude_empty_option !== true) {
226-
options.unshift('')
225+
if (options.length && element.exclude_empty_option === true) {
226+
options = options.filter(option => option !== "")
227227
}
228228

229229
// option types with source self do not have a source field but the options as array

0 commit comments

Comments
 (0)