Skip to content

Commit

Permalink
support nested types
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnEstropia committed Feb 22, 2024
1 parent 178ee53 commit 65ab543
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Sources/StorybookMacrosPlugin/StorybookPageMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ public struct StorybookPageMacro: DeclarationMacro {
closure: ClosureExprSyntax
) {
var argumentsIterator = node.argumentList.makeIterator()
var title: ExprSyntax? = node.genericArgumentClause?.arguments.first?.argument
.as(IdentifierTypeSyntax.self)
var title: ExprSyntax? = (node.genericArgumentClause?.arguments.first?.argument)
.flatMap { genericType -> TypeSyntaxProtocol? in
genericType.as(IdentifierTypeSyntax.self)
?? genericType.as(MemberTypeSyntax.self)
}
.map({ .init(stringLiteral: "_typeName(\($0).self)") })

var closure: ClosureExprSyntax? = node.trailingClosure
Expand Down

0 comments on commit 65ab543

Please sign in to comment.