From 1eb8d6b94cdd823686c6a848284b0e3955d3bb10 Mon Sep 17 00:00:00 2001 From: zzz701 Date: Fri, 8 Aug 2025 14:36:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20RecordData=20=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8F=8F=E8=BF=B0=E4=BF=A1=E6=81=AF=20Signed-off-by:?= =?UTF-8?q?=20zzz701=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/@ohos.base.d.ets | 185 ------------------------------------ api/@ohos.base.d.ts | 4 +- api/@ohos.base.static.d.ets | 115 ++++++++++++++++++++++ 3 files changed, 117 insertions(+), 187 deletions(-) delete mode 100644 api/@ohos.base.d.ets create mode 100644 api/@ohos.base.static.d.ets diff --git a/api/@ohos.base.d.ets b/api/@ohos.base.d.ets deleted file mode 100644 index 591226d639..0000000000 --- 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 b9930a4b6f..12b9052cb6 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 0000000000..3e22da2fda --- /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 -- Gitee