!3366 change the type used in ts from global

Merge pull request !3366 from 王曹宇/bugfix_use_type_in_ts
This commit is contained in:
openharmony_ci 2024-05-23 02:52:28 +00:00 committed by Gitee
commit 3f2b496707
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -230,14 +230,20 @@ export function checkTypeReference(node: ts.TypeReferenceNode, transformLog: Fil
const sourceBaseName: string = path.basename(sourceFile.fileName);
if (isArkuiDependence(sourceFile.fileName) &&
sourceBaseName !== 'common_ts_ets_api.d.ts' &&
sourceBaseName !== 'global.d.ts' ||
GLOBAL_DECLARE_WHITE_LIST.has(currentTypeName) &&
ohosSystemModulePaths.includes(sourceFile.fileName.replace(/\//g, '\\'))) {
sourceBaseName !== 'global.d.ts'
) {
transformLog.errors.push({
type: LogType.ERROR,
message: `Cannot find name '${currentTypeName}'.`,
pos: node.getStart()
});
} else if (GLOBAL_DECLARE_WHITE_LIST.has(currentTypeName) &&
ohosSystemModulePaths.includes(sourceFile.fileName.replace(/\//g, '\\'))) {
transformLog.errors.push({
type: LogType.WARN,
message: `Cannot find name '${currentTypeName}'.`,
pos: node.getStart()
});
}
}
}