mirror of
https://github.com/openharmony/tools_previewer.git
synced 2026-07-01 20:44:05 -04:00
@@ -19,6 +19,8 @@ import path from 'path';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import type { SourceFile } from 'typescript';
|
import type { SourceFile } from 'typescript';
|
||||||
|
|
||||||
|
const interceptIndex = 2;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generate type alias
|
* generate type alias
|
||||||
* @param typeAliasEntity
|
* @param typeAliasEntity
|
||||||
@@ -56,7 +58,7 @@ function getImportFileFullPath(typeName: string): string {
|
|||||||
if (!importRelatePathTmp) {
|
if (!importRelatePathTmp) {
|
||||||
return '';
|
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);
|
const tmpRealPath = getOhosInterfacesDir() + importRelatePath.replace('../api', '').replace(/\//g, path.sep);
|
||||||
if (fs.existsSync(tmpRealPath + '.d.ts')) {
|
if (fs.existsSync(tmpRealPath + '.d.ts')) {
|
||||||
return tmpRealPath + '.d.ts';
|
return tmpRealPath + '.d.ts';
|
||||||
|
|||||||
Reference in New Issue
Block a user