From c7e7913b0ce9e105ae44225ffb170186706f3025 Mon Sep 17 00:00:00 2001 From: Martin Sajti Date: Mon, 19 May 2025 15:53:33 +0200 Subject: [PATCH] [cherrry-pick 0603] Fix invlid code after primitive type refactor Change-Id: I0615ceabceb8503b09b036dbbb595fe63eda1bc7 Signed-off-by: Martin Sajti --- .../common_event/ets/@ohos.commonEventManager.ets | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/interfaces/kits/ani/common_event/ets/@ohos.commonEventManager.ets b/interfaces/kits/ani/common_event/ets/@ohos.commonEventManager.ets index 5ea46d91..9c0cee0e 100644 --- a/interfaces/kits/ani/common_event/ets/@ohos.commonEventManager.ets +++ b/interfaces/kits/ani/common_event/ets/@ohos.commonEventManager.ets @@ -25,7 +25,7 @@ const ERROR_PARAM_INVALID = 401; const errorParamInvalid: BusinessError = {code: ERROR_PARAM_INVALID, data: "Invalid parameter"}; type ResolveCallback = (data: T) => void; -type RejectCallback = (err: Object) => void; +type RejectCallback = (err: Error) => void; namespace commonEventManager { loadLibrary("ani_commoneventmanager.z"); @@ -81,7 +81,7 @@ namespace commonEventManager { } export function publishAsUser(event: string, userId: number, callback: AsyncCallback): void { - let publishAsUserId: Int = userId as Int; + let publishAsUserId: Int = userId.toInt(); let task = taskpool.execute(commonEventManager.publishAsUserExecute, event, publishAsUserId); task.then((e: NullishType)=>{ let resultCode: Int = e as Int; @@ -100,7 +100,7 @@ namespace commonEventManager { export function publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback): void { - let publishAsUserId: Int = userId as Int; + let publishAsUserId: Int = userId.toInt(); let task = taskpool.execute(commonEventManager.publishAsUserWithOptionsExecute, event, publishAsUserId, options); task.then((e: NullishType)=>{ let resultCode: Int = e as Int; @@ -213,7 +213,7 @@ namespace commonEventManager { let task = taskpool.execute(commonEventManager.removeStickyCommonEventExecute, event); task.then((data: NullishType): void => { resolve(undefined); - }, (error: Object): void => { + }, (error: Error): void => { hilog.error(0xD001202, TAG, 'removeStickyCommonEvent Promise error'); reject(error); }); @@ -236,7 +236,7 @@ namespace commonEventManager { let task = taskpool.execute(commonEventManager.setStaticSubscriberStateExecute, enable); task.then((e: NullishType): void => { resolve(undefined); - }, (error: Object): void => { + }, (error: Error): void => { hilog.error(0xD001202, TAG, 'setStaticSubscriberState Promise error'); reject(error); }); @@ -249,7 +249,7 @@ namespace commonEventManager { let task = taskpool.execute(commonEventManager.setStaticSubscriberStateWithEventsExecute, enable, events); task.then((e: NullishType): void => { resolve(undefined); - }, (error: Object): void => { + }, (error: Error): void => { hilog.error(0xD001202, TAG, 'setStaticSubscriberStateExecute Promise error.'); reject(error); }); -- Gitee