diff --git a/api/@ohos.base.d.ets b/api/@ohos.base.d.ets deleted file mode 100644 index 591226d639c505ce2a26a42289c2a4b280433637..0000000000000000000000000000000000000000 --- a/api/@ohos.base.d.ets +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @file - * @kit BasicServicesKit - */ - -/** - * Defines the basic callback. - * - * @typedef { Callback } - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ -export type Callback = (data: T) => void; - -/** - * Defines the basic error callback. - * - * @typedef { ErrorCallback } - * @syscap SystemCapability.Base - * @crossplatform - * @atomicservice - * @since 20 - */ -export type ErrorCallback = (err: T)=> void; - -/** - * Defines the basic async callback. - * - * @typedef { AsyncCallback } - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ -export type AsyncCallback = (err: BusinessError | null, data: T | undefined)=> void; - -/** - * Defines the error interface. - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ -export declare class BusinessError extends Error { - /** - * A constructor used to create a BusinessError object - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ - constructor(); - /** - * A constructor used to create a BusinessError object - * @params { int } code - * @params { Error } error - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ - constructor(code: int, error: Error); - /** - * A constructor used to create a BusinessError object - * @params { int } code - * @params { T } data - * @params { Error } error - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ - constructor(code: int, data: T, error: Error); - /** - * Defines the basic error code. - * @type { number } code - * @syscap SystemCapability.Base - * @since 6 - */ - /** - * Defines the basic error code. - * @type { number } code - * @syscap SystemCapability.Base - * @crossplatform - * @since 10 - */ - /** - * Defines the basic error code. - * @type { number } code - * @syscap SystemCapability.Base - * @crossplatform - * @atomicservice - * @since 11 - */ - /** - * Defines the basic error code. - * @type { number } code - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 12 - */ - /** - * Defines the basic error code. - * @type { int } code - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ - code: int; - /** - * Defines the additional information for business - * @type { ?T } data - * @syscap SystemCapability.Base - * @since 9 - */ - /** - * Defines the additional information for business - * @type { ?T } data - * @syscap SystemCapability.Base - * @crossplatform - * @since 10 - */ - /** - * Defines the additional information for business - * @type { ?T } data - * @syscap SystemCapability.Base - * @crossplatform - * @atomicservice - * @since 11 - */ - /** - * Defines the additional information for business - * @type { ?T } data - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 12 - */ - /** - * Defines the additional information for business - * @type { ?T } data - * @syscap SystemCapability.Base - * @crossplatform - * @form - * @atomicservice - * @since 20 - */ - data?: T; -} - -/** - * Defines RecordData type. - * @typedef RecordData - * @syscap SystemCapability.Base - * @since 20 - */ -export type RecordData = undefined | null | Object | Record | Array; diff --git a/api/@ohos.base.d.ts b/api/@ohos.base.d.ts index b9930a4b6fd6d393f4a13ed87f19241bed4f52da..12b9052cb6b144cee8c112b3ba7b76e4c7de60f8 100644 --- a/api/@ohos.base.d.ts +++ b/api/@ohos.base.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -84,7 +84,7 @@ export interface Callback { /** * Defines the basic error callback. - * @typedef ErrorCallback + * @typedef ErrorCallback * @syscap SystemCapability.Base * @since 6 */ diff --git a/api/@ohos.base.static.d.ets b/api/@ohos.base.static.d.ets new file mode 100644 index 0000000000000000000000000000000000000000..3e22da2fda6e645109aa920ac1250d6f7f65be4b --- /dev/null +++ b/api/@ohos.base.static.d.ets @@ -0,0 +1,115 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @kit BasicServicesKit + */ + +/** + * Defines the basic callback. + * + * @typedef { Callback } + * @syscap SystemCapability.Base + * @since 20 + */ + export type Callback = (data: T) => void; + + /** + * Defines the basic error callback. + * + * @typedef { ErrorCallback } + * @syscap SystemCapability.Base + * @since 20 + */ + export type ErrorCallback = (err: T)=> void; + + /** + * Defines the basic async callback. + * + * @typedef { AsyncCallback } + * @syscap SystemCapability.Base + * @since 20 + */ + export type AsyncCallback = (err: BusinessError | null, data: T | undefined)=> void; + + /** + * Defines the error interface. + * @syscap SystemCapability.Base + * @since 20 + */ + export declare class BusinessError extends Error { + /** + * A constructor used to create a BusinessError object + * @syscap SystemCapability.Base + * @since 20 + */ + constructor(); + /** + * A constructor used to create a BusinessError object + * @param { int } code + * @param { Error } error + * @syscap SystemCapability.Base + * @since 20 + */ + constructor(code: int, error: Error); + /** + * A constructor used to create a BusinessError object + * @param { int } code + * @param { T } data + * @param { Error } error + * @syscap SystemCapability.Base + * @since 20 + */ + constructor(code: int, data: T, error: Error); + + /** + * Defines the basic error code. + * @type { int } code + * @syscap SystemCapability.Base + * @since 20 + */ + code: int; + /** + * Defines the additional information for business + * @type { ?T } data + * @syscap SystemCapability.Base + * @since 20 + */ + data?: T; + } + + /** + * In ArkTS static typing, for literals where the hierarchy and the number + * of attributes per level are uncertain, you can use RecordData for initialization. + * @typedef RecordData + * @syscap SystemCapability.Base + * @since 20 + * @example + * import { RecordData } from '@kit.BasicServiceKit'; + * const param: RecordData = { + * "key": { + * "a": 1 + * } + * } + * let want: Want = { + * bundleName: 'com.example.myapplication', + * abilityName: 'EntryAbility', + * parameters: param + * }; + * this.context.startAbility(want); + */ + export type RecordData = undefined | null | Object | Record | Array; + \ No newline at end of file