Skip to content

Commit

Permalink
fix(storybook): optional chaining for typename text (#12235)
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #12155
  • Loading branch information
mandarini authored Sep 27, 2022
1 parent d423df6 commit 24880aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/react/src/utils/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ export function getComponentPropsInterface(
(x) => ts.isParameter(x) && (x.name as ts.Identifier).text === 'props'
);

if (propsParam && propsParam.type) {
if (propsParam?.type?.['typeName']) {
propsTypeName = (
(propsParam.type as ts.TypeReferenceNode).typeName as ts.Identifier
).text;
Expand All @@ -639,7 +639,7 @@ export function getComponentPropsInterface(
if (propsTypeExpression && propsTypeExpression.typeArguments) {
propsTypeName = (
propsTypeExpression.typeArguments[0] as ts.TypeReferenceNode
).typeName.getText();
).typeName?.getText();
}
}
} else {
Expand Down

0 comments on commit 24880aa

Please sign in to comment.