From 5f8a4c6b7e751b4a282a82a431a2835aa4598301 Mon Sep 17 00:00:00 2001 From: yangjun Date: Fri, 1 Aug 2025 14:30:05 +0800 Subject: [PATCH 1/3] =?UTF-8?q?emitter=E6=94=AF=E6=8C=811.1=E4=B8=8E1.2?= =?UTF-8?q?=E5=85=A8=E9=87=8F=E4=BA=92=E9=80=9A,=201.2=E6=B7=BB=E5=8A=A0ES?= =?UTF-8?q?Object=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangjun --- api/@ohos.events.emitter.d.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/api/@ohos.events.emitter.d.ts b/api/@ohos.events.emitter.d.ts index b67693c8d0..650c400de8 100644 --- a/api/@ohos.events.emitter.d.ts +++ b/api/@ohos.events.emitter.d.ts @@ -519,13 +519,13 @@ declare namespace emitter { /** * Data carried by the event. * - * @type { ?Record } + * @type { ?(Record | ESObject) } * @syscap SystemCapability.Notification.Emitter * @crossplatform * @since 20 * @arkts 1.2 */ - data?: Record; + data?: Record | ESObject; } /** @@ -782,16 +782,27 @@ declare namespace emitter { */ export interface GenericEventData { /** - * Data passed in the event. T: generic type. + * Data carried by the event. * * @type { ?T } * @syscap SystemCapability.Notification.Emitter * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ data?: T; + + /** + * Data carried by the event. + * + * @type { ?(T | ESObject) } + * @syscap SystemCapability.Notification.Emitter + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + data?: T | ESObject; } } -- Gitee From ef5a42ce98e3cec82ab0c2d204e9d4ecb34581c6 Mon Sep 17 00:00:00 2001 From: chengyuli Date: Thu, 17 Jul 2025 09:50:52 +0800 Subject: [PATCH 2/3] https://gitee.com/openharmony/arkcompiler_runtime_core/issues/ICHR85 Signed-off-by: chengyuli Change-Id: Iccedfc0ac80b7bb018bce937d0f774297004f124 --- api/@ohos.util.ArrayList.d.ts | 164 +++++++++++++++-------------- api/@ohos.util.Deque.d.ts | 60 +++++------ api/@ohos.util.HashMap.d.ts | 4 +- api/@ohos.util.HashSet.d.ts | 4 +- api/@ohos.util.LightWeightMap.d.ts | 70 +++++------- api/@ohos.util.LightWeightSet.d.ts | 20 ++-- api/@ohos.util.LinkedList.d.ts | 36 +++---- api/@ohos.util.List.d.ts | 92 ++++++++++------ api/@ohos.util.PlainArray.d.ts | 58 +++++----- api/@ohos.util.Queue.d.ts | 8 +- api/@ohos.util.Stack.d.ts | 12 +-- api/@ohos.util.TreeMap.d.ts | 8 +- api/@ohos.util.TreeSet.d.ts | 8 +- 13 files changed, 281 insertions(+), 263 deletions(-) diff --git a/api/@ohos.util.ArrayList.d.ts b/api/@ohos.util.ArrayList.d.ts index 3ee27aaf42..2aefa7b0d3 100644 --- a/api/@ohos.util.ArrayList.d.ts +++ b/api/@ohos.util.ArrayList.d.ts @@ -98,14 +98,14 @@ declare class ArrayList { /** * Gets the number of elements in an array list. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this arraylist. * @@ -175,7 +175,7 @@ declare class ArrayList { * Inserts an element at the specified position in this container. * * @param { T } element - Target element. - * @param { number } index - Index of the position where the element is to be inserted. + * @param { int } index - Index of the position where the element is to be inserted. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -188,7 +188,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(element: T, index: number): void; + insert(element: T, index: int): void; /** * Check if arraylist contains the specified element * @@ -246,7 +246,7 @@ declare class ArrayList { * Obtains the index of the first occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns { int } the number type ,returns the lowest index such that or -1 if there is no such index. * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -254,7 +254,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index, * delete the element, and move the index of all elements to the right of the element forward by one. @@ -289,7 +289,7 @@ declare class ArrayList { /** * Removes an element with the specified position from this container. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @returns { T } the T type ,returns undefined if arraylist is empty,If the index is * @throws { BusinessError } 10200001 - The value of "index" is out of range. * @throws { BusinessError } 10200011 - The removeByIndex method cannot be bound. @@ -303,7 +303,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeByIndex(index: number): T; + removeByIndex(index: int): T; /** * Removes the first occurrence of the specified element from this arraylist, * if it is present. If the arraylist does not contain the element, it is @@ -365,7 +365,7 @@ declare class ArrayList { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type + * @returns { int } the number type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -373,7 +373,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Removes from this arraylist all of the elements whose index is between fromIndex,inclusive,and toIndex ,exclusive. * @@ -407,8 +407,8 @@ declare class ArrayList { * Removes from this container all of the elements within a range, including the element at the start position but * not that at the end position. * - * @param { number } fromIndex - Index of the start position. - * @param { number } toIndex - Index of the end position. + * @param { int } fromIndex - Index of the start position. + * @param { int } toIndex - Index of the end position. * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. * @throws { BusinessError } 10200011 - The removeByRange method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -421,7 +421,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeByRange(fromIndex: number, toIndex: number): void; + removeByRange(fromIndex: int, toIndex: int): void; /** * Replaces each element of this arraylist with the result of applying the operator to that element. * @@ -593,10 +593,29 @@ declare class ArrayList { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} + * @since 12 + */ + /** + * Sorts this arraylist according to the order induced by the specified comparator,without comparator this parameter, + * it will default to ASCII sorting + * + * Anonymous Object Rectification + * @param { ArrayListComparatorFn } [comparator] - comparator + * comparator (Optional) A function that accepts up to two arguments.Specifies the sort order. + * Must be a function,return number type,If it returns firstValue minus secondValue, it returns an arraylist + * sorted in ascending order;If it returns secondValue minus firstValue, it returns an arraylist sorted in descending order; + * If this parameter is empty, it will default to ASCII sorting + * @throws { BusinessError } 10200011 - The sort method cannot be bound. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Incorrect parameter types; + * 2.Parameter verification failed. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 * @arkts 1.1&1.2 */ - sort(comparator?: (firstValue: T, secondValue: T) => number): void; + sort(comparator?: ArrayListComparatorFn): void; /** * Returns a view of the portion of this arraylist between the specified fromIndex,inclusive,and toIndex,exclusive * @@ -632,8 +651,8 @@ declare class ArrayList { * Obtains elements within a range in this container, including the element at the start position but not that at the * end position, and returns these elements as a new ArrayList instance. * - * @param { number } fromIndex - Index of the start position. - * @param { number } toIndex - Index of the end position. + * @param { int } fromIndex - Index of the start position. + * @param { int } toIndex - Index of the end position. * @returns { ArrayList } * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. * @throws { BusinessError } 10200011 - The subArrayList method cannot be bound. @@ -647,7 +666,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - subArrayList(fromIndex: number, toIndex: number): ArrayList; + subArrayList(fromIndex: int, toIndex: int): ArrayList; /** * Removes all of the elements from this arraylist.The arraylist will * be empty after this call returns.length becomes 0 @@ -725,7 +744,7 @@ declare class ArrayList { /** * Obtains the capacity of this container. * - * @returns { number } the number type + * @returns { int } the number type * @throws { BusinessError } 10200011 - The getCapacity method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -733,7 +752,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getCapacity(): number; + getCapacity(): int; /** * convert arraylist to array * @@ -795,7 +814,7 @@ declare class ArrayList { /** * Returns the element at the given index. * - * @param { number } index - Index. The value must be less than or equal to int32_max, that is, 2147483647. + * @param { int } index - Index. The value must be less than or equal to int32_max, that is, 2147483647. * @returns { T } The element in the arraylist matching the given index. * @throws { BusinessError } 401 - Parameter error. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -803,33 +822,7 @@ declare class ArrayList { * @atomicservice * @since 12 */ - [index: number]: T; - - /** - * Returns the item at that index. - * - * @param { number } index - The zero-based index of the desired code unit. - * @returns { T } The element in the arrayList matching the given index. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_get(index: number): T; - - /** - * Set the value of item at that index. - * - * @param { number } index - The index of the element to set. - * @param { T } value - The value to set at the specified index. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_set(index: number, value: T): void; + [index: int]: T; /** * If the newCapacity provided by the user is greater than or equal to length, @@ -859,7 +852,7 @@ declare class ArrayList { /** * Increases the capacity of this container. * - * @param { number } newCapacity - New capacity. + * @param { int } newCapacity - New capacity. * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -870,7 +863,7 @@ declare class ArrayList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(newCapacity: number): void; + increaseCapacityTo(newCapacity: int): void; /** * Limit the capacity to the current length * @@ -940,34 +933,49 @@ declare class ArrayList { $_iterator(): IterableIterator; } - /** - * The type of ArrayList callback function. - * - * @typedef { function } ArrayListCbFn - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { ArrayList } arrlist - The ArrayList instance being traversed - * @returns { void } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - type ArrayListCbFn = (value: T, index: number, arrlist: ArrayList) => void; +/** + * This type specifies the comparator of sort in comparation. + * + * @typedef { function } ArrayListComparatorFn + * @param { T } firstValue - firstValue (required) previous element. + * @param { T } secondValue - secondValue (required) next element. + * @returns { double } the number type + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ +export type ArrayListComparatorFn = (firstValue: T, secondValue: T) => double; - /** - * The type of ArrayList callback function. - * - * @typedef { function } ArrayListCbFn - * @param { T } value - The current element being processed - * @param { number } [index] - The index of the current element - * @param { ArrayList } [arrlist] - The ArrayList instance being traversed - * @returns { T } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - type ArrayListCbFn1 = (value: T, index?: number, arrlist?: ArrayList) => T; +/** + * The type of ArrayList callback function. + * + * @typedef { function } ArrayListForEachCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { ArrayList } arrlist - The ArrayList instance being traversed + * @returns { void } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ArrayListForEachCb = (value: T, index: int, arrlist: ArrayList) => void; + +/** + * The type of ArrayList callback function. + * + * @typedef { function } ArrayListReplaceCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { ArrayList } arrlist - The ArrayList instance being traversed + * @returns { T } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type ArrayListReplaceCb = (value: T, index: int, arrlist: ArrayList) => T; export default ArrayList; diff --git a/api/@ohos.util.Deque.d.ts b/api/@ohos.util.Deque.d.ts index 8e4758b126..66bbab5732 100644 --- a/api/@ohos.util.Deque.d.ts +++ b/api/@ohos.util.Deque.d.ts @@ -101,14 +101,14 @@ declare class Deque { /** * Gets the element number of the Deque. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Inserts an element into the deque header. * @@ -426,32 +426,22 @@ declare class Deque { * @since 20 * @arkts 1.2 */ - forEach(callbackFn: DequeCbFnforEach): void; - /** - * Returns the byte at the specified index. - * - * @param { number } index - The zero-based index of the desired code unit. - * @returns { T } The element in the deque matching the given index. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - $_get(index: number): T; + forEach(callbackFn: DequeForEachCb): void; - /** - * Sets the byte at the specified index. - * - * @param { number } index – The index of the element to set. - * @param { T } value – The value to set at the specified index. + /** + * Returns the item at that index. + * + * @param { int } index - The zero-based index of the desired code unit. + * Throws error if index < 0 or index >= deque.length. + * @returns { T } The element in the deque matching the given index. + * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_set(index: number, value: T): void; + [index: int]: T; /** * returns an iterator.Each item of the iterator is a Javascript Object @@ -495,19 +485,19 @@ declare class Deque { $_iterator(): IterableIterator; } - /** - * The type of Deque forEach callback function. - * - * @typedef { function } DequeCbFnforEach - * @param { T } value - The current element being processed - * @param { number } index - The index of the current element - * @param { Deque } deque - The Deque instance being traversed - * @returns { void } This callback does not return a value - * @syscap SystemCapability.Utils.Lang - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - type DequeCbFnforEach = (value: T, index: number, deque: Deque) => void; +/** + * The type of Deque forEach callback function. + * + * @typedef { function } DequeForEachCb + * @param { T } value - The current element being processed + * @param { int } index - The index of the current element + * @param { Deque } deque - The Deque instance being traversed + * @returns { void } This callback does not return a value + * @syscap SystemCapability.Utils.Lang + * @atomicservice + * @since 20 + * @arkts 1.2 + */ +export type DequeForEachCb = (value: T, index: int, deque: Deque) => void; export default Deque; diff --git a/api/@ohos.util.HashMap.d.ts b/api/@ohos.util.HashMap.d.ts index d95f7ca2cb..4dcada17fe 100644 --- a/api/@ohos.util.HashMap.d.ts +++ b/api/@ohos.util.HashMap.d.ts @@ -98,14 +98,14 @@ declare class HashMap { /** * Gets the number of elements in a hash map. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Map object contains elements * diff --git a/api/@ohos.util.HashSet.d.ts b/api/@ohos.util.HashSet.d.ts index 654a6e7c8f..92b648bfc0 100644 --- a/api/@ohos.util.HashSet.d.ts +++ b/api/@ohos.util.HashSet.d.ts @@ -95,14 +95,14 @@ declare class HashSet { /** * Gets the element number of the HashSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Set object contains elements * diff --git a/api/@ohos.util.LightWeightMap.d.ts b/api/@ohos.util.LightWeightMap.d.ts index 4b64ae7b16..8de439ed5b 100644 --- a/api/@ohos.util.LightWeightMap.d.ts +++ b/api/@ohos.util.LightWeightMap.d.ts @@ -95,14 +95,14 @@ declare class LightWeightMap { /** * Gets the element number of the LightWeightMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether this map has all the object in a specified map * @@ -237,7 +237,7 @@ declare class LightWeightMap { * Ensures that the capacity of an LightWeightMap container is greater than or equal to a specified value, * and that the container has all the original objects after capacity expansion * - * @param { number } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved + * @param { int } minimumCapacity - minimumCapacity minimumCapacity Minimum capacity to be reserved * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -248,7 +248,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(minimumCapacity: number): void; + increaseCapacityTo(minimumCapacity: int): void; /** * Returns a new Iterator object that contains the [key, value] pairs for each element in the Map object in insertion order * @@ -346,7 +346,7 @@ declare class LightWeightMap { * Obtains the index of the key equal to a specified key in an LightWeightMap container * * @param { K } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -354,7 +354,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfKey(key: K): number; + getIndexOfKey(key: K): int; /** * Obtains the index of the value equal to a specified value in an LightWeightMap container * @@ -378,7 +378,7 @@ declare class LightWeightMap { * Obtains the index of the value equal to a specified value in an LightWeightMap container * * @param { V } value - value value Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -386,7 +386,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfValue(value: V): number; + getIndexOfValue(value: V): int; /** * Returns whether the Map object contains elements * @@ -462,25 +462,19 @@ declare class LightWeightMap { * @since 12 */ getKeyAt(index: number): K; - - /** - * Obtains the key at the location identified by index in an LightWeightMap container - * - * @param { number } index - index index Target subscript for search - * @returns { K | undefined } the key of key-value pairs - * @throws { BusinessError } 10200011 - The getKeyAt method cannot be bound. - * @throws { BusinessError } 10200001 - The value of index is out of range. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. - * @syscap SystemCapability.Utils.Lang - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - getKeyAt(index: number): K | undefined; + /** + * Obtains the key at the location identified by index in an LightWeightMap container + * + * @param { int } index - index index Target subscript for search + * @returns { K | undefined } the key of key-value pairs or undefined + * @throws { BusinessError } 10200001 - The value of index is out of range. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + getKeyAt(index: int): K | undefined; /** @@ -658,7 +652,7 @@ declare class LightWeightMap { /** * Deletes a key-value pair at the location identified by index from an LightWeightMap container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { boolean } the boolean type(Is there a delete value) * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -670,7 +664,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeAt(index: number): boolean; + removeAt(index: int): boolean; /** * Removes all of the mapping from this map * The map will be empty after this call returns @@ -734,7 +728,7 @@ declare class LightWeightMap { /** * Sets the value identified by index in an LightWeightMap container to a specified value * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @param { V } newValue - newValue value Updated the target mapped value * @returns { boolean } the boolean type(Is there a value corresponding to the subscript) * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. @@ -749,7 +743,7 @@ declare class LightWeightMap { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - setValueAt(index: number, newValue: V): boolean; + setValueAt(index: int, newValue: V): boolean; /** * Executes the given callback function once for each real key in the map. * It does not perform functions on deleted keys. @@ -934,25 +928,19 @@ declare class LightWeightMap { * @since 12 */ getValueAt(index: number): V; - - /** +/** * Obtains the value identified by index in an LightWeightMap container * - * @param { number } index - index index Target subscript for search - * @returns { V | undefined } the value of key-value pairs - * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. + * @param { int } index - index index Target subscript for search + * @returns { V | undefined } the value of key-value pairs or undefined * @throws { BusinessError } 10200001 - The value of index is out of range. - * @throws { BusinessError } 401 - Parameter error. Possible causes: - * 1.Mandatory parameters are left unspecified; - * 2.Incorrect parameter types; - * 3.Parameter verification failed. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - getValueAt(index: number): V | undefined; + getValueAt(index: int): V | undefined; /** * Returns an iterator of the values contained in this map diff --git a/api/@ohos.util.LightWeightSet.d.ts b/api/@ohos.util.LightWeightSet.d.ts index 612b677db1..180648d149 100644 --- a/api/@ohos.util.LightWeightSet.d.ts +++ b/api/@ohos.util.LightWeightSet.d.ts @@ -96,14 +96,14 @@ declare class LightWeightSet { /** * Gets the element number of the LightWeightSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * If the set does not contain the element, the specified element is added @@ -305,7 +305,7 @@ declare class LightWeightSet { * Ensures that the capacity of an LightWeightSet container is greater than or equal to a specified value, * and that the container has all the original objects after capacity expansion * - * @param { number } minimumCapacity Minimum capacity to be reserved + * @param { int } minimumCapacity Minimum capacity to be reserved * @throws { BusinessError } 10200011 - The increaseCapacityTo method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -318,7 +318,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - increaseCapacityTo(minimumCapacity: number): void; + increaseCapacityTo(minimumCapacity: int): void; /** * Obtains the index of s key of a specified Object type in an LightWeightSet container * @@ -342,7 +342,7 @@ declare class LightWeightSet { * Obtains the index of s key of a specified Object type in an LightWeightSet container * * @param { T } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -350,7 +350,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(key: T): number; + getIndexOf(key: T): int; /** * Deletes an object of a specified Object type from an LightWeightSet container * @@ -424,7 +424,7 @@ declare class LightWeightSet { /** * Deletes an object at the location identified by index from an LightWeightSet container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { boolean } the boolean type(Is there a delete value) * @throws { BusinessError } 10200011 - The removeAt method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -436,7 +436,7 @@ declare class LightWeightSet { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeAt(index: number): boolean; + removeAt(index: int): boolean; /** * Removes all of the mapping from this map * The map will be empty after this call returns @@ -675,7 +675,7 @@ declare class LightWeightSet { /** * Obtains the object at the location identified by index in an LightWeightSet container * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { T | undefined } the value at the specified index, or undefined if the index out of range * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -683,7 +683,7 @@ declare class LightWeightSet { * @since 20 * @arkts 1.2 */ - getValueAt(index: number): T | undefined; + getValueAt(index: int): T | undefined; /** * Returns a ES6 iterator of the values contained in this Set diff --git a/api/@ohos.util.LinkedList.d.ts b/api/@ohos.util.LinkedList.d.ts index 37160e6cf5..9928002778 100644 --- a/api/@ohos.util.LinkedList.d.ts +++ b/api/@ohos.util.LinkedList.d.ts @@ -101,14 +101,14 @@ declare class LinkedList { /** * Gets the element number of the LinkedList. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this linkedlist. @@ -173,7 +173,7 @@ declare class LinkedList { */ /** * Inserts an element at the specified position in this container. - * @param { number } index - Index of the position where the element is to be inserted. + * @param { int } index - Index of the position where the element is to be inserted. * @param { T } element - Target element. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -187,7 +187,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(index: number, element: T): void; + insert(index: int, element: T): void; /** * Returns the element at the specified position in this linkedlist, * or returns undefined if this linkedlist is empty @@ -234,7 +234,7 @@ declare class LinkedList { /** * Obtains an element at the specified position in this container. * - * @param { number } index - Position index of the target element. + * @param { int } index - specified position * @returns { T | undefined} the element at the specified index, or undefined if the index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -242,7 +242,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - get(index: number): T | undefined; + get(index: int): T | undefined; /** * Inserts the specified element at the beginning of this LinkedList. @@ -420,7 +420,7 @@ declare class LinkedList { * Obtains the index of the first occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns { int } the int type ,returns the lowest index such that or -1 if there is no such index. * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -428,7 +428,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index. * @@ -482,7 +482,7 @@ declare class LinkedList { /** * Find the corresponding element according to the index. * - * @param { number } index - the index in the linkedList + * @param { int } index - the index in the linkedList * @returns { T | undefined } the T type, if the index is * out of bounds (greater than or equal to length or less than 0), throw an exception * @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length}. @@ -493,7 +493,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - removeByIndex(index: number): T | undefined; + removeByIndex(index: int): T | undefined; /** * Removes the first occurrence of the specified element from this linkedlist, @@ -640,7 +640,7 @@ declare class LinkedList { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type + * @returns { int } the int type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -648,7 +648,7 @@ declare class LinkedList { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Returns the first element (the item at index 0) of this linkedlist. * or returns undefined if linkedlist is empty @@ -788,7 +788,7 @@ declare class LinkedList { /** * Replaces an element at the specified position in this container with a given element. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @param { T } element - Element to be used for replacement. * @returns { T | undefined } the T type ,returns undefined if linkedList is empty * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -801,7 +801,7 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ - set(index: number, element: T): T | undefined; + set(index: int, element: T): T | undefined; /** * Replaces each element of this linkedlist with the result of applying the operator to that element. @@ -974,7 +974,7 @@ declare class LinkedList { * @since 10 */ /** - * Obtains an iterator, each item of which is a JavaScript object. + * returns an iterator.Each item of the iterator is a Javascript Object * * @returns { IterableIterator } * @throws { BusinessError } 10200011 - The Symbol.iterator method cannot be bound. @@ -986,7 +986,7 @@ declare class LinkedList { [Symbol.iterator](): IterableIterator; /** - * Obtains an iterator, each item of which is a JavaScript object. + * returns an iterator. Each item of the iterator is a ArkTS Object * * @returns { IterableIterator } * @syscap SystemCapability.Utils.Lang @@ -1004,7 +1004,7 @@ declare class LinkedList { * * @typedef { function } LinkedListForEachCb * @param { T } value - The value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { LinkedList } linkedList - The LinkedList instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -1012,6 +1012,6 @@ declare class LinkedList { * @since 20 * @arkts 1.2 */ -type LinkedListForEachCb = (value: T, index: number, linkedList: LinkedList) => void +export type LinkedListForEachCb = (value: T, index: int, linkedList: LinkedList) => void export default LinkedList; diff --git a/api/@ohos.util.List.d.ts b/api/@ohos.util.List.d.ts index b2fe9cc1e4..05bfb10a5b 100644 --- a/api/@ohos.util.List.d.ts +++ b/api/@ohos.util.List.d.ts @@ -100,14 +100,14 @@ declare class List { /** * Gets the element number of the List. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends the specified element to the end of this list. @@ -174,7 +174,7 @@ declare class List { * Inserts an element at the specified position in this container. * * @param { T } element - Target element. - * @param { number } index - Index of the position where the element is to be inserted. + * @param { int } index - Index of the position where the element is to be inserted. * @throws { BusinessError } 10200011 - The insert method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -187,7 +187,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - insert(element: T, index: number): void; + insert(element: T, index: int): void; /** * Returns the element at the specified position in this list, * or returns undefined if this list is empty @@ -235,7 +235,7 @@ declare class List { * Returns the element at the specified position in this list, * or returns undefined if this list is empty * - * @param { number } index - specified position + * @param { int } index - specified position * @returns { T | undefined} the element at the specified index, or undefined if the index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -243,7 +243,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - get(index: number): T | undefined; + get(index: int): T | undefined; /** * Check if list contains the specified element @@ -302,7 +302,7 @@ declare class List { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type ,returns the lowest index such that or -1 if there is no such index. + * @returns { int } the int type ,returns the lowest index such that or -1 if there is no such index. * @throws { BusinessError } 10200011 - The getIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -310,7 +310,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOf(element: T): number; + getIndexOf(element: T): int; /** * Find the corresponding element according to the index. * @@ -361,7 +361,7 @@ declare class List { /** * Searches for an element based on its index and then removes it. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @returns { T | undefined } the T type, if the index is * out of bounds (greater than or equal to length or less than 0), throw an exception * @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}. @@ -372,7 +372,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - removeByIndex(index: number): T | undefined; + removeByIndex(index: int): T | undefined; /** * Removes the first occurrence of the specified element from this list, @@ -435,7 +435,7 @@ declare class List { * Obtains the index of the last occurrence of the specified element in this container. * * @param { T } element - Target element. - * @returns { number } the number type + * @returns { int } the number type * @throws { BusinessError } 10200011 - The getLastIndexOf method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -443,7 +443,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getLastIndexOf(element: T): number; + getLastIndexOf(element: T): int; /** * Returns the first element (the item at index 0) of this list. * or returns undefined if list is empty @@ -578,7 +578,7 @@ declare class List { /** * Replaces an element at the specified position in this container with a given element. * - * @param { number } index - Position index of the target element. + * @param { int } index - Position index of the target element. * @param { T } element - Element to be used for replacement. * @returns { T | undefined } the T type, returns undefined if linkedList is empty * @throws { BusinessError } 10200001 - The value of "index" is out of range. It must be >= 0 && <= ${length - 1}. @@ -589,7 +589,7 @@ declare class List { * @since 20 * @arkts 1.2 */ - set(index: number, element: T): T | undefined; + set(index: int, element: T): T | undefined; /** * Compares the specified object with this list for equality.if the object are the same as this list * return true, otherwise return false. @@ -727,10 +727,28 @@ declare class List { * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice - * @since arkts {'1.1':'12', '1.2':'20'} + * @since 12 + */ + /** + * Sorts this list according to the order induced by the specified comparator + * + * Anonymous Object Rectification + * @param { ListComparatorFn } comparator - comparator + * comparator (required) A function that accepts up to two arguments. + * Specifies the sort order. Must be a function,return number type,If it returns firstValue + * minus secondValue, it returns an list sorted in ascending order;If it returns secondValue + * minus firstValue, it returns an list sorted in descending order; + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1.Mandatory parameters are left unspecified; + * 2.Incorrect parameter types. + * @throws { BusinessError } 10200011 - The sort method cannot be bound. + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 * @arkts 1.1&1.2 */ - sort(comparator: (firstValue: T, secondValue: T) => number): void; + sort(comparator: ListComparatorFn): void; /** * Removes all of the elements from this list.The list will * be empty after this call returns.length becomes 0 @@ -792,8 +810,8 @@ declare class List { * Obtains elements within a range in this container, including the element at the start position but not that at the * end position, and returns these elements as a new List instance. * - * @param { number } fromIndex - Index of the start position. - * @param { number } toIndex - Index of the end position. + * @param { int } fromIndex - Index of the start position. + * @param { int } toIndex - Index of the end position. * @returns { List } * @throws { BusinessError } 10200011 - The getSubList method cannot be bound. * @throws { BusinessError } 10200001 - The value of fromIndex or toIndex is out of range. @@ -806,7 +824,7 @@ declare class List { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getSubList(fromIndex: number, toIndex: number): List; + getSubList(fromIndex: int, toIndex: int): List; /** * Replaces each element of this list with the result of applying the operator to that element. * @@ -926,18 +944,19 @@ declare class List { */ isEmpty(): boolean; /** - * Returns the item at that index - * - * @param { number } index - the zero-based index of the desired code unit. - * @returns { T | undefined } the element in the list matching the given index, - * or undefined if the index is out of range. + * Returns the item at that index. + * + * @param { int } index - The zero-based index of the desired code unit. + * Throws error if index < 0 or index >= list.length. + * @returns { T } The element in the list matching the given index. + * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_get(index: number): T | undefined; + [index: int]: T; /** * Set the value of item at that index. @@ -993,13 +1012,26 @@ declare class List { $_iterator(): IterableIterator; } - +/** + * This type specifies the comparator of sort in comparation. + * + * @typedef { function } ListComparatorFn + * @param { T } firstValue - firstValue (required) previous element. + * @param { T } secondValue - secondValue (required) next element. + * @returns { double } the number type + * @syscap SystemCapability.Utils.Lang + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.1&1.2 + */ +export type ListComparatorFn = (firstValue: T, secondValue: T) => double; /** * The type of List callback function. * * @typedef { function } ListForEachCb * @param { T } value - The value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { List } list - The List instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -1007,14 +1039,14 @@ declare class List { * @since 20 * @arkts 1.2 */ -type ListForEachCb = (value: T, index: number, list: List) => void +export type ListForEachCb = (value: T, index: int, list: List) => void /** * The type of List callback function. * * @typedef { function } LinkedListForEachCb * @param { T } value - The old value of current element - * @param { number } index - The index of current element + * @param { int } index - The index of current element * @param { List } list - The List instance being traversed * @returns { T } - The new value of current element * @syscap SystemCapability.Utils.Lang @@ -1022,6 +1054,6 @@ type ListForEachCb = (value: T, index: number, list: List) => void * @since 20 * @arkts 1.2 */ -type ListReplaceCb = (value: T, index: number, list: List) => T +export type ListReplaceCb = (value: T, index: int, list: List) => T export default List; diff --git a/api/@ohos.util.PlainArray.d.ts b/api/@ohos.util.PlainArray.d.ts index 6b28d6ba11..a4b5e2ede7 100644 --- a/api/@ohos.util.PlainArray.d.ts +++ b/api/@ohos.util.PlainArray.d.ts @@ -99,14 +99,14 @@ declare class PlainArray { /** * Gets the element number of the PlainArray. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Appends a key-value pair to PlainArray @@ -136,7 +136,7 @@ declare class PlainArray { /** * Appends a key-value pair to PlainArray * - * @param { number } key - key key Added the key of key-value + * @param { int } key - key key Added the key of key-value * @param { T } value - value value Added the value of key-value * @throws { BusinessError } 10200011 - The add method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -148,7 +148,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - add(key: number, value: T): void; + add(key: int, value: T): void; /** * Clears the current PlainArray object * @@ -232,7 +232,7 @@ declare class PlainArray { /** * Checks whether the current PlainArray object contains the specified key * - * @param { number } key - key key need to determine whether to include the key + * @param { int } key - key key need to determine whether to include the key * @returns { boolean } the boolean type * @throws { BusinessError } 10200011 - The has method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -244,7 +244,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - has(key: number): boolean; + has(key: int): boolean; /** * Queries the value associated with the specified key * @@ -289,7 +289,7 @@ declare class PlainArray { /** * Queries the value associated with the specified key * - * @param { number } key - looking for goals + * @param { int } key - looking for goals * @returns { T | undefined } the value of key-value pairs * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -298,7 +298,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - get(key: number): T | undefined; + get(key: int): T | undefined; /** * Queries the index for a specified key @@ -328,8 +328,8 @@ declare class PlainArray { /** * Queries the index for a specified key * - * @param { number } key - key key Looking for goals - * @returns { number } Subscript corresponding to target + * @param { int } key - key key Looking for goals + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfKey method cannot be bound. * @throws { BusinessError } 401 - Parameter error. Possible causes: * 1.Mandatory parameters are left unspecified; @@ -340,7 +340,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfKey(key: number): number; + getIndexOfKey(key: int): int; /** * Queries the index for a specified value * @@ -364,7 +364,7 @@ declare class PlainArray { * Queries the index for a specified value * * @param { T } value - value value Looking for goals - * @returns { number } Subscript corresponding to target + * @returns { int } Subscript corresponding to target * @throws { BusinessError } 10200011 - The getIndexOfValue method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -372,7 +372,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getIndexOfValue(value: T): number; + getIndexOfValue(value: T): int; /** * Checks whether the current PlainArray object is empty * @@ -487,7 +487,7 @@ declare class PlainArray { /** * Remove the key-value pair based on a specified key if it exists and return the value * - * @param { number } key - target to be deleted + * @param { int } key - target to be deleted * @returns { T | undefined } target mapped value, or undefined if key is not exist * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -496,7 +496,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - remove(key: number): T | undefined; + remove(key: int): T | undefined; /** * Remove the key-value pair at a specified index if it exists and return the value @@ -542,7 +542,7 @@ declare class PlainArray { /** * Remove the key-value pair at a specified index if it exists and return the value * - * @param { number } index - target subscript for search + * @param { int } index - target subscript for search * @returns { T | undefined } the T type, or undefined if container is empty * @throws { BusinessError } 10200001 - The value of index is out of range. * @syscap SystemCapability.Utils.Lang @@ -551,7 +551,7 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ - removeAt(index: number): T | undefined; + removeAt(index: int): T | undefined; /** * Remove a group of key-value pairs from a specified index @@ -585,9 +585,9 @@ declare class PlainArray { /** * Remove a group of key-value pairs from a specified index * - * @param { number } index - index index remove start index - * @param { number } size - size size Expected deletion quantity - * @returns { number } Actual deleted quantity + * @param { int } index - index index remove start index + * @param { int } size - size size Expected deletion quantity + * @returns { int } Actual deleted quantity * @throws { BusinessError } 10200011 - The removeRangeFrom method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. * @throws { BusinessError } 401 - Parameter error. Possible causes: @@ -599,7 +599,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - removeRangeFrom(index: number, size: number): number; + removeRangeFrom(index: int, size: int): int; /** * Update value on specified index * @@ -630,7 +630,7 @@ declare class PlainArray { /** * Update value on specified index * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @param { T } value - value value Updated the target mapped value * @throws { BusinessError } 10200011 - The setValueAt method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -643,7 +643,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - setValueAt(index: number, value: T): void; + setValueAt(index: int, value: T): void; /** * Obtains the string representation of the PlainArray object * @@ -703,7 +703,7 @@ declare class PlainArray { /** * Queries the value at a specified index * - * @param { number } index - index index Target subscript for search + * @param { int } index - index index Target subscript for search * @returns { T } the value of key-value pairs * @throws { BusinessError } 10200011 - The getValueAt method cannot be bound. * @throws { BusinessError } 10200001 - The value of index is out of range. @@ -716,7 +716,7 @@ declare class PlainArray { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - getValueAt(index: number): T; + getValueAt(index: int): T; /** * Executes a provided function once for each value in the PlainArray object. * @@ -814,14 +814,14 @@ declare class PlainArray { /** * returns an iterator. Each item of the iterator is a ArkTS Object * - * @returns { IterableIterator<[number, T]> } + * @returns { IterableIterator<[int, T]> } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - $_iterator(): IterableIterator<[number, T]>; + $_iterator(): IterableIterator<[int, T]>; } @@ -830,7 +830,7 @@ declare class PlainArray { * * @typedef { function } PlainArrayForEachCb * @param { T } value - The value of current element - * @param { number } key - The key of current element + * @param { int } key - The key of current element * @param { PlainArray } PlainArray - The PlainArray instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -838,6 +838,6 @@ declare class PlainArray { * @since 20 * @arkts 1.2 */ -type PlainArrayForEachCb = (value: T, key: number, PlainArray: PlainArray) => void +export type PlainArrayForEachCb = (value: T, key: int, PlainArray: PlainArray) => void export default PlainArray; diff --git a/api/@ohos.util.Queue.d.ts b/api/@ohos.util.Queue.d.ts index abdba11d47..37ec882239 100644 --- a/api/@ohos.util.Queue.d.ts +++ b/api/@ohos.util.Queue.d.ts @@ -102,14 +102,14 @@ declare class Queue { /** * Gets the element number of the Queue. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Inserting specified element at the end of a queue if it is possible to do @@ -341,7 +341,7 @@ declare class Queue { * * @typedef { function } QueueForEachCb * @param { T } value - The value of current element - * @param { number } index - The key of current element + * @param { int } index - The key of current element * @param { Queue } queue - The Queue instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -349,6 +349,6 @@ declare class Queue { * @since 20 * @arkts 1.2 */ -type QueueForEachCb = (value: T, index: number, queue: Queue) => void +export type QueueForEachCb = (value: T, index: int, queue: Queue) => void export default Queue; diff --git a/api/@ohos.util.Stack.d.ts b/api/@ohos.util.Stack.d.ts index 340ed2c85f..2dc7eedf00 100644 --- a/api/@ohos.util.Stack.d.ts +++ b/api/@ohos.util.Stack.d.ts @@ -99,14 +99,14 @@ declare class Stack { /** * Gets the element number of the Stack. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Tests if this stack is empty @@ -282,7 +282,7 @@ declare class Stack { * Returns the 1-based position where an object is on this stack * * @param { T } element - element element Target to be deleted - * @returns { number } the T type,If there is no such element, return -1 + * @returns { int } the T type,If there is no such element, return -1 * @throws { BusinessError } 10200011 - The locate method cannot be bound. * @syscap SystemCapability.Utils.Lang * @crossplatform @@ -290,7 +290,7 @@ declare class Stack { * @since arkts {'1.1':'12', '1.2':'20'} * @arkts 1.1&1.2 */ - locate(element: T): number; + locate(element: T): int; /** * Executes a provided function once for each value in the Stack object. * @@ -404,7 +404,7 @@ declare class Stack { * * @typedef { function } StackForEachCb * @param { T } value - The value of current element - * @param { number } index - The key of current element + * @param { int } index - The key of current element * @param { Stack } stack - The Stack instance being traversed * @returns { void } This callback does not return a value * @syscap SystemCapability.Utils.Lang @@ -412,6 +412,6 @@ declare class Stack { * @since 20 * @arkts 1.2 */ -type StackForEachCb = (value: T, index: number, stack: Stack) => void +export type StackForEachCb = (value: T, index: int, stack: Stack) => void export default Stack; diff --git a/api/@ohos.util.TreeMap.d.ts b/api/@ohos.util.TreeMap.d.ts index ad93707e33..a3bcd465d7 100644 --- a/api/@ohos.util.TreeMap.d.ts +++ b/api/@ohos.util.TreeMap.d.ts @@ -136,14 +136,14 @@ declare class TreeMap { /** * Gets the element number of the TreeMap. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Map object contains elements @@ -879,12 +879,12 @@ type TreeMapForEachCb = (value: V, key: K, map: TreeMap) => void * @typedef { function } TreeMapComparator * @param { K } firstValue - The first value compared * @param { K } secondValue - The second value compared - * @returns { number } - Comparison results + * @returns { double } - Comparison results * @syscap SystemCapability.Utils.Lang * @atomicservice * @since 20 * @arkts 1.2 */ -type TreeMapComparator = (firstValue: K, secondValue: K) => number +export type TreeMapComparator = (firstValue: K, secondValue: K) => double export default TreeMap; diff --git a/api/@ohos.util.TreeSet.d.ts b/api/@ohos.util.TreeSet.d.ts index d09e7b0548..045367b7fa 100644 --- a/api/@ohos.util.TreeSet.d.ts +++ b/api/@ohos.util.TreeSet.d.ts @@ -133,14 +133,14 @@ declare class TreeSet { /** * Gets the element number of the TreeSet. * - * @type { number } + * @type { int } * @syscap SystemCapability.Utils.Lang * @crossplatform * @atomicservice * @since 20 * @arkts 1.2 */ - get length(): number; + get length(): int; /** * Returns whether the Set object contains elements @@ -773,12 +773,12 @@ type TreeSetForEachCb = (value: T, key: T, set: TreeSet) => void * @typedef { function } TreeSetComparator * @param { T } firstValue - The first value compared * @param { T } secondValue - The second value compared - * @returns { number } - Comparison results + * @returns { double } - Comparison results * @syscap SystemCapability.Utils.Lang * @atomicservice * @since 20 * @arkts 1.2 */ -type TreeSetComparator = (firstValue: T, secondValue: T) => number +export type TreeSetComparator = (firstValue: T, secondValue: T) => double export default TreeSet; -- Gitee From cd113c4f95bf7090a93237370532c3b5d662bf3b Mon Sep 17 00:00:00 2001 From: guozejun Date: Thu, 4 Sep 2025 10:47:13 +0800 Subject: [PATCH 3/3] Update ArkUI API dependencies Signed-off-by: guozejun Change-Id: I4fecc79595cca9c812a8dfe5df1b2ee9b911a740 --- api/@ohos.arkui.node.d.ts | 38 ++------ api/@ohos.arkui.node.static.d.ets | 95 +++++++++++++++++++ api/arkui/AttributeUpdater.d.ets | 2 +- .../stateManagement/base/backingValue.d.ets | 2 +- .../base/mutableStateMeta.d.ets | 2 +- .../decorators/decoratorLink.d.ets | 2 +- build-tools/delete_systemapi_plugin.js | 19 +++- 7 files changed, 126 insertions(+), 34 deletions(-) create mode 100644 api/@ohos.arkui.node.static.d.ets diff --git a/api/@ohos.arkui.node.d.ts b/api/@ohos.arkui.node.d.ts index 18fde8db2e..ceb0533452 100644 --- a/api/@ohos.arkui.node.d.ts +++ b/api/@ohos.arkui.node.d.ts @@ -29,8 +29,7 @@ * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { NodeRenderType, RenderOptions, BuilderNode } from './arkui/BuilderNode'; @@ -39,8 +38,7 @@ export { NodeRenderType, RenderOptions, BuilderNode } from './arkui/BuilderNode' * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { BuildOptions } from './arkui/BuilderNode'; @@ -68,8 +66,7 @@ export { InputEventType } from './arkui/BuilderNode'; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { NodeController } from './arkui/NodeController'; @@ -96,19 +93,7 @@ export { FrameNode, LayoutConstraint, ExpandMode, UIState } from './arkui/FrameN * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export { FrameNode, LayoutConstraint, ExpandMode } from './arkui/FrameNode'; - -/** - * Export FrameNode. FrameNode defines a basic type of node which contains a RenderNode. - * - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { typeNode, NodeAdapter } from './arkui/FrameNode'; @@ -136,8 +121,7 @@ export { DrawContext, Size, Offset, Position, Pivot, Scale, Translation, Matrix4 * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { LengthUnit, SizeT, LengthMetrics, ColorMetrics } from './arkui/Graphics'; @@ -154,8 +138,7 @@ export { LengthUnit, SizeT, LengthMetrics, ColorMetrics } from './arkui/Graphics * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { RenderNode } from './arkui/RenderNode'; @@ -182,8 +165,7 @@ export { XComponentNode } from './arkui/XComponentNode'; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { Content } from './arkui/Content'; @@ -193,8 +175,7 @@ export { Content } from './arkui/Content'; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { ComponentContent } from './arkui/ComponentContent'; @@ -204,7 +185,6 @@ export { ComponentContent } from './arkui/ComponentContent'; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts { '1.1':'12','1.2':'20' } - * @arkts 1.1&1.2 + * @since 12 */ export { NodeContent } from './arkui/NodeContent'; \ No newline at end of file diff --git a/api/@ohos.arkui.node.static.d.ets b/api/@ohos.arkui.node.static.d.ets new file mode 100644 index 0000000000..9a9aaa4b3a --- /dev/null +++ b/api/@ohos.arkui.node.static.d.ets @@ -0,0 +1,95 @@ +/* + * Copyright (c) 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 ArkUI + * @arkts 1.2 + */ + +export { NodeRenderType, RenderOptions, BuilderNode } from 'arkui.BuilderNode'; +/** + * Export BuildOptions which is used to create a node trees by builder function and manage the update of the tree. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { BuildOptions } from 'arkui.BuilderNode'; + +/** + * Export NodeController, which defines the controller of node container. + * Provides lifecycle callbacks for the associated NodeContainer + * and methods to control the child node of the NodeContainer. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { NodeController } from 'arkui.NodeController'; +/** + * Export FrameNode. FrameNode defines a basic type of node which contains a RenderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { FrameNode, LayoutConstraint, ExpandMode } from 'arkui.FrameNode'; +/** + * Export FrameNode. FrameNode defines a basic type of node which contains a RenderNode. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { typeNode, NodeAdapter } from 'arkui.FrameNode'; + +/** + * Export Graphics. Defines the basic types related to the Graphics. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { DrawContext, Size, Offset, Position, Pivot, Scale, Translation, Matrix4, Rotation, Frame, RoundRect, Circle, CommandPath, ShapeMask, ShapeClip, NodeBorderRadiuses, CornerRadius, Rect, Edges, edgeColors, edgeWidths, borderStyles, borderRadiuses, LengthMetricsUnit } from 'arkui.Graphics'; +/** + * Export Graphics. Defines the basic types related to the Graphics. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { LengthUnit, SizeT, LengthMetrics, ColorMetrics } from 'arkui.Graphics'; + +/** + * Export RenderNode. RenderNode contains node tree operations and render property operations on node. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { RenderNode } from 'arkui.RenderNode'; +/** + * Export Content. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { Content } from 'arkui.Content'; +/** + * Export ComponentContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { ComponentContent, ComponentContentBase } from 'arkui.ComponentContent'; +/** + * Export NodeContent. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export { NodeContent } from 'arkui.NodeContent'; diff --git a/api/arkui/AttributeUpdater.d.ets b/api/arkui/AttributeUpdater.d.ets index 73d63dec00..eb35c88c13 100644 --- a/api/arkui/AttributeUpdater.d.ets +++ b/api/arkui/AttributeUpdater.d.ets @@ -18,7 +18,7 @@ * @kit ArkUI */ -import { AttributeModifier } from './component/common' +import { AttributeModifier } from '@ohos.arkui.component'; /** * function that returns a default param of AttributeUpdater. diff --git a/api/arkui/stateManagement/base/backingValue.d.ets b/api/arkui/stateManagement/base/backingValue.d.ets index 0a915e71f3..a511eb44bd 100644 --- a/api/arkui/stateManagement/base/backingValue.d.ets +++ b/api/arkui/stateManagement/base/backingValue.d.ets @@ -22,4 +22,4 @@ public constructor(initValue: T) public get value(): T public set value(newVale: T) - } \ No newline at end of file + } diff --git a/api/arkui/stateManagement/base/mutableStateMeta.d.ets b/api/arkui/stateManagement/base/mutableStateMeta.d.ets index 6aee33a1b1..b6f3114ec9 100644 --- a/api/arkui/stateManagement/base/mutableStateMeta.d.ets +++ b/api/arkui/stateManagement/base/mutableStateMeta.d.ets @@ -32,4 +32,4 @@ export declare class MutableKeyedStateMeta extends MutableStateMetaBase { public addRef(key: string): void public fireChange(key: string): void public constructor(decorator: string) -} \ No newline at end of file +} diff --git a/api/arkui/stateManagement/decorators/decoratorLink.d.ets b/api/arkui/stateManagement/decorators/decoratorLink.d.ets index 5d65d77dac..8762af44b2 100644 --- a/api/arkui/stateManagement/decorators/decoratorLink.d.ets +++ b/api/arkui/stateManagement/decorators/decoratorLink.d.ets @@ -26,4 +26,4 @@ export declare class LinkDecoratedVariable extends DecoratedV1VariableBase public constructor(varName: string, source: DecoratedV1VariableBase, watchFunc?: WatchFuncType) public get(): T public set(newValue: T): void -} \ No newline at end of file +} diff --git a/build-tools/delete_systemapi_plugin.js b/build-tools/delete_systemapi_plugin.js index 2f584e4f5e..d318f5947a 100644 --- a/build-tools/delete_systemapi_plugin.js +++ b/build-tools/delete_systemapi_plugin.js @@ -301,7 +301,24 @@ function hasFileByImportPath(apiDir, importPath) { fileDir = path.resolve(inputDir, '../arkts'); } return isExistImportFile(fileDir, importPath) || - isExistArkUIFile(path.resolve(inputDir, 'arkui', 'component'), importPath); + isExistArkUIFile(path.resolve(inputDir, 'arkui', 'component'), importPath) || + isDotPathExist(fileDir, importPath); +} + +/** + * Dot路径特殊处理 + * @param {string} resolvedPath 引用接口所在目录 + * @param {string} importPath kit文件import + * @returns {boolean} importPath是否存在 + */ +function isDotPathExist(fileDir, importPath) { + if (['./', '@ohos', '@system'].every(str => { + return importPath.includes(str); + })) { + return false; + } + const replaced = importPath.replace(/\./g, '/'); + return isExistImportFile(fileDir, replaced); } -- Gitee