diff --git a/zh-cn/application-dev/quick-start/arkts-state.md b/zh-cn/application-dev/quick-start/arkts-state.md index c1fd5dd5cd17569604028957edb6e96cd27d7ec9..857c1244f38335c55b84cb27ba85d5cea4494bde 100644 --- a/zh-cn/application-dev/quick-start/arkts-state.md +++ b/zh-cn/application-dev/quick-start/arkts-state.md @@ -296,5 +296,14 @@ struct MyComponent { 2. 对于\@State来说,命名参数机制传递的值并不是必选的,如果没有命名参数传值,则使用本地初始化的默认值: ```ts - MyComponent({ count: 1, increaseBy: 2 }) + class C1 { + public count:number; + public increaseBy:number; + constructor(count: number, increaseBy:number) { + this.count = count; + this.increaseBy = increaseBy; + } + } + let obj = new C1(1, 2) + MyComponent(obj) ``` diff --git a/zh-cn/application-dev/quick-start/har-package.md b/zh-cn/application-dev/quick-start/har-package.md index 110559b41e9ae4659da13663b7f140d5080ec6e0..0dbf9a34fd1f68a5a54f5a9297c27fe2a29302cb 100644 --- a/zh-cn/application-dev/quick-start/har-package.md +++ b/zh-cn/application-dev/quick-start/har-package.md @@ -103,7 +103,7 @@ export { MainPage } from './src/main/ets/components/MainPage/MainPage' ```js // library/src/main/ts/test.ets export class Log { - static info(msg) { + static info(msg: string) { console.info(msg); } } diff --git a/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md b/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md index c97f538546fad141400dbc65f94ef961c0d8a483..acfcb76c08aa96b12d602f2bbcef74eb7c64c3ac 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md +++ b/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md @@ -136,13 +136,14 @@ setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: Upg ```js import freeInstall from '@ohos.bundle.freeInstall'; +import { BusinessError } from '@ohos.base'; let bundleName = 'com.example.myapplication'; let moduleName = 'entry'; let upgradeFlag = freeInstall.UpgradeFlag.SINGLE_UPGRADE; try { freeInstall.setHapModuleUpgradeFlag(bundleName, moduleName, upgradeFlag).then(() => { console.info('Operation succeed') - }).catch(err => { + }).catch((err: BusinessError) => { console.error('Operation failed:' + JSON.stringify(err)); }); } catch (err) { @@ -236,12 +237,13 @@ isHapModuleRemovable(bundleName: string, moduleName: string): Promise\; ```js import freeInstall from '@ohos.bundle.freeInstall'; +import { BusinessError } from '@ohos.base'; let bundleName = 'com.example.myapplication'; let moduleName = 'entry'; try { freeInstall.isHapModuleRemovable(bundleName, moduleName).then(data => { console.info('Operation succeed:' + JSON.stringify(data)); - }).catch(err => { + }).catch((err: BusinessError) => { console.error('Operation failed:' + JSON.stringify(err)); }); } catch (err) { @@ -332,12 +334,13 @@ getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\ ```js import freeInstall from '@ohos.bundle.freeInstall'; +import { BusinessError } from '@ohos.base'; let bundleName = 'com.example.myapplication'; let bundlePackFlag = freeInstall.BundlePackFlag.GET_PACK_INFO_ALL; try { freeInstall.getBundlePackInfo(bundleName, bundlePackFlag).then(data => { console.info('Operation succeed:' + JSON.stringify(data)); - }).catch(err => { + }).catch((err: BusinessError) => { console.error('Operation failed:' + JSON.stringify(err)); }); } catch (err) { @@ -402,10 +405,11 @@ getDispatchInfo(): Promise\; ```js import freeInstall from '@ohos.bundle.freeInstall'; +import { BusinessError } from '@ohos.base'; try { freeInstall.getDispatchInfo().then(data => { console.info('Operation succeed:' + JSON.stringify(data)); - }).catch(err => { + }).catch((err: BusinessError) => { console.error('Operation failed:' + JSON.stringify(err)); }); } catch (err) {