diff --git a/code/HelloWorld/entry/src/main/ets/entryability/EntryAbility.ets b/code/HelloWorld/entry/src/main/ets/entryability/EntryAbility.ets index b8c877dac17545fcb0420d1228764fd174d1e9d9..383b70a79a76ebd79404ef616d4879d0ea6bf1ec 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 708065d57cb910dc5f650d166f31b130b729e6ca..f5885d2bbbccbc584eb349fb4b688d56f33beb41 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}`); }