Skip to content

Commit e768518

Browse files
authored
fix(typescript-plugin): add nullish guards before accessing ts.CompletionEntryData (#5869)
1 parent 78f0ce8 commit e768518

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/typescript-plugin/lib/common.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,10 @@ export function resolveCompletionResult<T>(
517517
export function resolveCompletionEntryDetails(
518518
language: Language<any>,
519519
details: ts.CompletionEntryDetails,
520-
data: any,
520+
data: Record<string, any> | undefined,
521521
) {
522522
// modify import statement
523-
if (data.__isComponentAutoImport) {
523+
if (data?.__isComponentAutoImport) {
524524
const { oldName, newName } = data.__isComponentAutoImport;
525525
for (const codeAction of details?.codeActions ?? []) {
526526
for (const change of codeAction.changes) {
@@ -533,7 +533,7 @@ export function resolveCompletionEntryDetails(
533533
}
534534
}
535535
}
536-
if (data.__isAutoImport) {
536+
if (data?.__isAutoImport) {
537537
const { fileName } = data.__isAutoImport;
538538
const sourceScript = language.scripts.get(fileName);
539539
if (sourceScript?.generated?.root instanceof VueVirtualCode) {

0 commit comments

Comments
 (0)