Skip to content

Commit 5da353f

Browse files
committed
fix: use displayName only for functional components
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.
1 parent f6dd259 commit 5da353f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/utils/find.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ export function matches(
3636
}
3737

3838
let componentName: string | undefined
39-
if ('name' in nodeType || 'displayName' in nodeType) {
40-
// match normal component definitions or functional components
41-
componentName = nodeType.name || nodeType.displayName
39+
if ('name' in nodeType) {
40+
// match normal component definitions
41+
componentName = nodeType.name
42+
}
43+
if (!componentName && 'displayName' in nodeType) {
44+
// match functional components
45+
componentName = nodeType.displayName
4246
}
4347
let selectorName = selector.name
4448

0 commit comments

Comments
 (0)