diff --git a/arkui-plugins/memo-plugins/utils.ts b/arkui-plugins/memo-plugins/utils.ts index 31cb1ff549ed69e08669616d60621cdbbd3be071..68fc086bd65628bfc3e4b3186744777483e93252 100644 --- a/arkui-plugins/memo-plugins/utils.ts +++ b/arkui-plugins/memo-plugins/utils.ts @@ -450,9 +450,14 @@ export function findMemoFromTypeAnnotation(typeAnnotation: arkts.AstNode | undef } if (arkts.isETSTypeReference(typeAnnotation) && !!typeAnnotation.part && !!typeAnnotation.part.name) { let decl: arkts.AstNode | undefined = arkts.getDecl(typeAnnotation.part.name); - if (!!decl && arkts.isTSTypeAliasDeclaration(decl)) { - return hasMemoAnnotation(decl) || hasMemoIntrinsicAnnotation(decl) || decl.typeAnnotation ? findMemoFromTypeAnnotation(decl.typeAnnotation) : false; + if (!decl || !arkts.isTSTypeAliasDeclaration(decl)) { + return false; + } + let isMemo: boolean = hasMemoAnnotation(decl) || hasMemoIntrinsicAnnotation(decl); + if (!isMemo && !!decl.typeAnnotation) { + isMemo = findMemoFromTypeAnnotation(decl.typeAnnotation); } + return isMemo; } else if (arkts.isETSFunctionType(typeAnnotation)) { return hasMemoAnnotation(typeAnnotation) || hasMemoIntrinsicAnnotation(typeAnnotation); } else if (arkts.isETSUnionType(typeAnnotation)) {