Skip to content

Commit eb00c50

Browse files
committed
fix(typescript-plugin): handle name case correctly when getting component props
1 parent bc59d9a commit eb00c50

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/typescript-plugin/lib/client.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { camelize, capitalize } from '@vue/shared';
12
import type { RequestData } from './server';
23
import { getBestServer } from './utils';
34

@@ -48,7 +49,9 @@ export async function getComponentProps(fileName: string, componentName: string)
4849
if (!componentAndProps) {
4950
return;
5051
}
51-
return componentAndProps[componentName];
52+
return componentAndProps[componentName]
53+
?? componentAndProps[camelize(componentName)]
54+
?? componentAndProps[capitalize(camelize(componentName))];
5255
}
5356

5457
export function getComponentEvents(

packages/typescript-plugin/lib/requests/componentInfos.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,9 @@ export function getComponentProps(
2323

2424
const name = tag.split('.');
2525

26-
let componentSymbol = components.type.getProperty(name[0]);
27-
28-
if (!componentSymbol) {
29-
componentSymbol = components.type.getProperty(camelize(name[0]))
30-
?? components.type.getProperty(capitalize(camelize(name[0])));
31-
}
26+
let componentSymbol = components.type.getProperty(name[0])
27+
?? components.type.getProperty(camelize(name[0]))
28+
?? components.type.getProperty(capitalize(camelize(name[0])));
3229

3330
if (!componentSymbol) {
3431
return [];

0 commit comments

Comments
 (0)