From e8493681b5c9229c3000ee05bfaf2881918292dd Mon Sep 17 00:00:00 2001 From: Fouckttt Date: Tue, 5 Aug 2025 10:26:21 +0800 Subject: [PATCH] Overload Correction Issue:https://gitee.com/openharmony/interface_sdk-js/issues/ICNFPU Signed-off-by: Fouckttt --- interfaces/ets/ani/ets/@ohos.configPolicy.ets | 34 ++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/interfaces/ets/ani/ets/@ohos.configPolicy.ets b/interfaces/ets/ani/ets/@ohos.configPolicy.ets index 16929ba..85fef2a 100644 --- a/interfaces/ets/ani/ets/@ohos.configPolicy.ets +++ b/interfaces/ets/ani/ets/@ohos.configPolicy.ets @@ -33,7 +33,7 @@ namespace configPolicy { native function getCfgDirListSync(): Array; - function getOneCfgFile(relPath: string, callback: AsyncCallback) : void { + function getOneCfgFileWithCallback(relPath: string, callback: AsyncCallback) : void { taskpool.execute((): string => { return getOneCfgFileSync(relPath); }).then((content: NullishType) => { @@ -43,7 +43,7 @@ namespace configPolicy { }); } - function getOneCfgFile(relPath: string, followMode: FollowXMode, callback: AsyncCallback) : void { + function getOneCfgFileWithFollowModeCallback(relPath: string, followMode: FollowXMode, callback: AsyncCallback) : void { taskpool.execute((): string => { return getOneCfgFileSync(relPath, followMode); }).then((content: NullishType) => { @@ -53,7 +53,7 @@ namespace configPolicy { }); } - function getOneCfgFile( + function getOneCfgFileWithFollowModeExtraCallback( relPath: string, followMode: FollowXMode, extra: string, callback: AsyncCallback) : void { taskpool.execute((): string => { return getOneCfgFileSync(relPath, followMode, extra); @@ -64,7 +64,7 @@ namespace configPolicy { }); } - function getOneCfgFile(relPath: string): Promise { + function getOneCfgFileReturnsPromise(relPath: string): Promise { return new Promise((resolve, reject) => { taskpool.execute((): string => { return getOneCfgFileSync(relPath); @@ -76,7 +76,7 @@ namespace configPolicy { }); } - function getOneCfgFile(relPath: string, followMode: FollowXMode, extra?: string): Promise { + function getOneCfgFileWithFollowModeReturnsPromise(relPath: string, followMode: FollowXMode, extra?: string): Promise { return new Promise((resolve, reject) => { taskpool.execute((): string => { return getOneCfgFileSync(relPath, followMode, extra); @@ -88,7 +88,11 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string, callback: AsyncCallback>) : void { + overload getOneCfgFile { getOneCfgFileWithCallback, getOneCfgFileWithFollowModeCallback, + getOneCfgFileWithFollowModeExtraCallback, getOneCfgFileReturnsPromise, + getOneCfgFileWithFollowModeReturnsPromise } + + function getCfgFilesWithCallback(relPath: string, callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgFilesSync(relPath); }).then((content: NullishType) => { @@ -98,7 +102,7 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string, followMode: FollowXMode, callback: AsyncCallback>) : void { + function getCfgFilesWithFollowModeCallback(relPath: string, followMode: FollowXMode, callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgFilesSync(relPath, followMode); }).then((content: NullishType) => { @@ -108,7 +112,7 @@ namespace configPolicy { }); } - function getCfgFiles( + function getCfgFilesWithFollowModeExtraCallback( relPath: string, followMode: FollowXMode, extra: string, callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgFilesSync(relPath, followMode, extra); @@ -119,7 +123,7 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string): Promise> { + function getCfgFilesReturnsPromise(relPath: string): Promise> { return new Promise>((resolve, reject) => { taskpool.execute((): Array => { return getCfgFilesSync(relPath); @@ -131,7 +135,7 @@ namespace configPolicy { }); } - function getCfgFiles(relPath: string, followMode: FollowXMode, extra?: string): Promise> { + function getCfgFilesWithFollowModeReturnsPromise(relPath: string, followMode: FollowXMode, extra?: string): Promise> { return new Promise>((resolve, reject) => { taskpool.execute((): Array => { return getCfgFilesSync(relPath, followMode, extra); @@ -143,7 +147,11 @@ namespace configPolicy { }); } - function getCfgDirList(callback: AsyncCallback>) : void { + overload getCfgFiles { getCfgFilesWithCallback, getCfgFilesWithFollowModeCallback, + getCfgFilesWithFollowModeExtraCallback, getCfgFilesReturnsPromise, + getCfgFilesWithFollowModeReturnsPromise } + + function getCfgDirListWithCallback(callback: AsyncCallback>) : void { taskpool.execute((): Array => { return getCfgDirListSync(); }).then((content: NullishType) => { @@ -153,7 +161,7 @@ namespace configPolicy { }); } - function getCfgDirList(): Promise> { + function getCfgDirListReturnsPromise(): Promise> { return new Promise>((resolve, reject) => { taskpool.execute((): Array => { return getCfgDirListSync(); @@ -164,6 +172,8 @@ namespace configPolicy { }); }); } + + overload getCfgDirList { getCfgDirListWithCallback, getCfgDirListReturnsPromise } } export default configPolicy; -- Gitee