Skip to content

Commit

Permalink
chore: defensive optional chaining for option extraction
Browse files Browse the repository at this point in the history
  • Loading branch information
snorrees committed Oct 1, 2024
1 parent 011610c commit a150e86
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ export function transformBlockType(

function resolveEnabledStyles(blockType: ObjectSchemaType): ManifestTitledValue[] | undefined {
const styleField = blockType.fields?.find((btField) => btField.name === 'style')
return resolveTitleValueArray(styleField?.type.options.list)
return resolveTitleValueArray(styleField?.type?.options?.list)
}

function resolveEnabledDecorators(spanType: ObjectSchemaType): ManifestTitledValue[] | undefined {
Expand All @@ -477,7 +477,7 @@ function resolveEnabledDecorators(spanType: ObjectSchemaType): ManifestTitledVal

function resolveEnabledListItems(blockType: ObjectSchemaType): ManifestTitledValue[] | undefined {
const listField = blockType.fields?.find((btField) => btField.name === 'listItem')
return resolveTitleValueArray(listField?.type?.options.list)
return resolveTitleValueArray(listField?.type?.options?.list)
}

function resolveTitleValueArray(possibleArray: unknown): ManifestTitledValue[] | undefined {
Expand Down

0 comments on commit a150e86

Please sign in to comment.