From 5513e8fec417c703d1040a546edc3f2e9285a98e Mon Sep 17 00:00:00 2001 From: zzz701 Date: Fri, 4 Jul 2025 19:08:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90helloword=E3=80=91AsyncCallback=20Erro?= =?UTF-8?q?r=E5=8F=98=E6=9B=B4=E5=8F=AF=E9=80=89=E7=9A=84=E5=8F=82?= =?UTF-8?q?=E6=95=B0=20Signed-off-by:=20zzz701=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entry/src/main/ets/entryability/EntryAbility.ets | 2 +- code/HelloWorld/entry/src/main/ets/models/MyCallback.ets | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/code/HelloWorld/entry/src/main/ets/entryability/EntryAbility.ets b/code/HelloWorld/entry/src/main/ets/entryability/EntryAbility.ets index b8c877dac1..383b70a79a 100644 --- a/code/HelloWorld/entry/src/main/ets/entryability/EntryAbility.ets +++ b/code/HelloWorld/entry/src/main/ets/entryability/EntryAbility.ets @@ -15,7 +15,7 @@ class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage): void { hilog.info(0x0000, 'testTag', 'EntryAbility onWindowStageCreate'); try { - windowStage.loadContent('pages/Index', (err: BusinessError): void => { + windowStage.loadContent('pages/Index', (err: BusinessError | null): void => { hilog.info(0x0000, 'testTag', 'loadContent entering'); MyCallback.runCasesOfCallback(); if (err) { diff --git a/code/HelloWorld/entry/src/main/ets/models/MyCallback.ets b/code/HelloWorld/entry/src/main/ets/models/MyCallback.ets index 708065d57c..f5885d2bbb 100644 --- a/code/HelloWorld/entry/src/main/ets/models/MyCallback.ets +++ b/code/HelloWorld/entry/src/main/ets/models/MyCallback.ets @@ -13,7 +13,7 @@ export class MyCallback { hilog.info(0x0000, 'testTag', 'myAsyncCallback'); let error = new Error('Business Error', 'basicError2 message', undefined); let be2: BusinessError = new BusinessError(SYNTAX_ERROR_CODE, error); - callback(be2, 'yAsyncCallback'); + callback(be2, 'myAsyncCallback'); } static myErrorCallback(callback: ErrorCallback>): void { @@ -28,7 +28,7 @@ export class MyCallback { MyCallback.myCallback((data: string) => { hilog.info(0x0000, 'testTag', 'MyCallback' + data); }) - MyCallback.myAsyncCallback((error: BusinessError, result: string) => { + MyCallback.myAsyncCallback((error: BusinessError | null, result: string | undefined) => { if (error && result) { hilog.info(0x0000, 'testTag', `myAsyncCallback, error: ${error.message}, result:${result}`); } -- Gitee