!157 处理魔鬼数字

Merge pull request !157 from yy/setNumber
This commit is contained in:
openharmony_ci
2023-09-21 12:30:45 +00:00
committed by Gitee
@@ -19,6 +19,8 @@ import path from 'path';
import fs from 'fs';
import type { SourceFile } from 'typescript';
const interceptIndex = 2;
/**
* generate type alias
* @param typeAliasEntity
@@ -56,7 +58,7 @@ function getImportFileFullPath(typeName: string): string {
if (!importRelatePathTmp) {
return '';
}
const importRelatePath = importRelatePathTmp[0].substring(2, importRelatePathTmp[0].length - 2);
const importRelatePath = importRelatePathTmp[0].substring(interceptIndex, importRelatePathTmp[0].length - interceptIndex);
const tmpRealPath = getOhosInterfacesDir() + importRelatePath.replace('../api', '').replace(/\//g, path.sep);
if (fs.existsSync(tmpRealPath + '.d.ts')) {
return tmpRealPath + '.d.ts';