Skip to content

Commit

Permalink
fix: use displayName only for functional components
Browse files Browse the repository at this point in the history
This fixes one of the issues that arise when bumping to vue 3.0.9.
There is no change in behavior: it just make TypeScript OK with the recent changes in vue-next.
  • Loading branch information
cexbrayat committed Mar 29, 2021
1 parent f6dd259 commit 5da353f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/find.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,13 @@ export function matches(
}

let componentName: string | undefined
if ('name' in nodeType || 'displayName' in nodeType) {
// match normal component definitions or functional components
componentName = nodeType.name || nodeType.displayName
if ('name' in nodeType) {
// match normal component definitions
componentName = nodeType.name
}
if (!componentName && 'displayName' in nodeType) {
// match functional components
componentName = nodeType.displayName
}
let selectorName = selector.name

Expand Down

0 comments on commit 5da353f

Please sign in to comment.