UNPKG

create-arena-project

Version:

神奇代码岛<->VSCode,从这里开始,创建一个神岛代码项目的脚手架。

1,510 lines (1,398 loc) 889 kB
/** * @zh 游戏日志方法类型 * @en Game logger method type */ declare type GameLoggerMethod = (...args: any[]) => void; /** * @zh 控制台对象,用于在控制台输出信息。 * @en The console object, used to output information to the console. */ declare const console: { /** * @zh 断言,如果断言为 false,则在控制台输出错误信息。 * @en Assertion, if the assertion is false, an error message is output to the console. */ assert: (assertion, ...args: any[]) => void; /** * @zh 在控制台输出日志信息。 * @en Outputs log information to the console. */ log: GameLoggerMethod; /** * @zh 在控制台输出调试信息。 * @en Outputs debug information to the console. */ debug: GameLoggerMethod; /** * @zh 在控制台输出错误信息。 * @en Outputs error information to the console. */ error: GameLoggerMethod; /** * @zh 在控制台输出警告信息。 * @en Outputs warning information to the console. */ warn: GameLoggerMethod; /** * @zh 清空控制台。 * @en Clears the console. */ clear: GameLoggerMethod; }; /** * @zh 因神岛平台限制,无法使用Nodejs原生模块,这里是模拟 Node.js 的 process 对象。 * @en Due to platform limitations, native Node.js modules cannot be used. This is a mock of the Node.js process object. */ declare const process: { /** * @zh 返回一个包含用户环境信息的对象。需结合插件dotenv-webpack使用。 * @en Returns an object containing user environment information. Requires the use of the dotenv-webpack plugin. * @link https://docs.dao3.fun/arenapro/zh/guide/six/env.html */ env: { [key: string]: string | undefined; }; }; /** * @zh GameWorld 是整个游戏世界的主要接口,它对应涵盖了控制环境天气、物理重力、画面滤镜等全局场景属性,还可以在世界中创建、搜索实体,或监听世界中实体和玩家的碰撞、伤害、互动等事件。 * @en GameWorld is the main interface for the entire game world. It covers global scene attributes such as controlling environmental weather, physics gravity, and screen filters. It can also be used to create and search for entities in the world, or listen for events such as collisions, damage, and interactions between entities and players. */ declare const world: GameWorld; /** * @zh GameVoxels 是控制游戏方块的接口,你可以控制地形变化,利用循环语法批量生成/销毁方块,获取某个方块的类型、名称、旋转角度等。 * @en GameVoxels is the interface for controlling game blocks. You can control terrain changes, use loop syntax to batch generate/destroy blocks, and get the type, name, rotation angle, etc. of a certain block. */ declare const voxels: GameVoxels; /** * @zh GameAssetListEntry 是控制游戏中的资产对象,用于获取游戏内模型、图片、音频等资源。 * @en GameAssetListEntry is an object that controls assets in the game, used to obtain in-game resources such as models, images, and audio. */ declare const resources: { /** * @zh 列出指定类型的游戏资源。 * @en Lists game resources of a specified type. * @param path * @zh 可选。指定游戏资源的类型。如果不提供,默认返回全部资源(包含脚本)。 * - 'snow': 查询雪贴图资源。 * - 'mesh': 查询体素模型资源。 * - 'picture': 查询图片资源。 * - 'audio': 查询音频资源。 * - 'lut': 查询滤镜资源。 * @en Optional. Specifies the type of game resource. If not provided, all resources (including scripts) are returned by default. * - 'snow': Query for snow texture resources. * - 'mesh': Query for voxel model resources. * - 'picture': Query for image resources. * - 'audio': Query for audio resources. * - 'lut': Query for filter resources. * @returns * @zh 返回一个 GameAssetListEntry 对象数组,每个对象代表一个游戏资源条目。 * @en Returns an array of GameAssetListEntry objects, each representing a game resource entry. */ ls: ( path?: "snow" | "mesh" | "picture" | "audio" | "lut" ) => GameAssetListEntry[]; }; /** * @zh 旧代编辑器使用的数据库接口,已弃用,请在使用GameDataStorage。 * @en The database interface used by the old editor, which is deprecated. Please use GameDataStorage. * @example * ``` * const sa = storage.getGroupStorage('boxGame'); * sa.get('box'); * ``` * @deprecated */ declare const db: GameDatabase; /** * @zh GameDataStorage 代表数据存储空间的类,能控制单地图或组地图数据库,能够以键值对的形式存储数据,提供方法处理空间内键值对相关的操作。 * @en GameDataStorage is a class that represents data storage space. It can control single-map or group-map databases, store data in the form of key-value pairs, and provide methods to handle operations related to key-value pairs in the space. */ declare const storage: GameStorage; /** * @zh GameHttpAPI 是可以链接外部网站数据的对象,用于对接第三方平台接口的操作。 * @en GameHttpAPI is an object that can link to external website data and is used for operations that interface with third-party platform APIs. */ declare const http: GameHttpAPI; /** * @zh GameRTC 是实时通讯技术,用于与其他游戏玩家语音交流的操作。 * @en GameRTC is a real-time communication technology used for voice communication with other game players. */ declare const rtc: GameRTC; /** * @zh GameAnalytics 是专业的游戏数据分析模块,提供强大的数据追踪与分析能力。借助此模块,你可以精确记录玩家行为、监控游戏事件并获取深入的数据洞察,为游戏优化和决策提供有力支持。 * @en GameAnalytics is a professional game data analysis module that provides powerful data tracking and analysis capabilities. With this module, you can accurately record player behavior, monitor game events, and obtain in-depth data insights to provide strong support for game optimization and decision-making. */ declare const analytics: GameAnalytics; /** * @zh 较老版本的GUI接口,已不推荐使用,请在客户端使用GameUI。 * @en An older version of the GUI interface, which is no longer recommended. Please use GameUI on the client side. * @example * ``` * const box = ui.findChildByName('box'); * box.zIndex=2; * ``` * @deprecated */ declare const gui: GameGUI; /** * @zh ServerRemoteChannel 是管理客户端与服务端通讯的对象,用于对跨端传递信息的操作。 * @en ServerRemoteChannel is an object that manages communication between the client and the server, used for cross-end information transfer operations. */ declare const remoteChannel: ServerRemoteChannel; /** * @zh sleep是一种函数,作用是延时,程序暂停若干时间。在执行时可能会抛出一个中断异常,建议对其进行捕获并处理。 * @en sleep is a function that delays the program for a certain period of time. It may throw an interruption exception during execution, and it is recommended to catch and handle it. * @param ms * @zh 延迟时间,单位为毫秒。 * @en The delay time in milliseconds. */ declare function sleep(ms: number): Promise<void>; /** * @zh 用于加载模块,返回模块对象。 * @en Used to load a module and return the module object. */ declare const require: { /** * @zh 加载模块,返回模块对象。 * @en Loads a module and returns the module object. * @param module * @zh 模块名称。 * @en The name of the module. */ (module: string): any; /** * @zh 解析模块的绝对路径。 * @en Resolves the absolute path of a module. * @param path * @zh 路径。 * @en The path. * @returns * @zh 模块的绝对路径。 * @en The absolute path of the module. */ resolve: (path: string) => string; }; /** * @zh 当前模块的引用。 * @en A reference to the current module. */ declare const module: { /** * @zh 导出模块的对象。 * @en The object that is exported by the module. */ exports: any; }; /** * 用于导出模块,返回模块对象。 */ declare const exports: any; /** * @zh 当前模块的目录名。这是一个只读属性。 * @en The directory name of the current module. This is a read-only property. */ declare const __dirname: string; /** * @zh 当前模块的文件名。这是一个只读属性。 * @en The file name of the current module. This is a read-only property. */ declare const __filename: string; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ interface Map<K, V> { /** * @zh 从 Map 对象中移除所有元素。 * @en Removes all elements from a Map object. */ clear(): void; /** * @zh 从 Map 对象中移除指定的元素。 * @en Removes the specified element from a Map object. * @param key * @zh 要移除的元素的键。 * @en The key of the element to remove. * @returns * @zh 如果元素成功移除,则返回 true;否则返回 false。 * @en Returns true if an element in the Map object existed and has been removed, or false if the element does not exist. */ delete(key: K): boolean; /** * @zh 对 Map 对象中的每个键值对执行一次提供的函数。 * @en Executes a provided function once for each key/value pair in the Map object. * @param callbackfn * @zh 为每个元素执行的函数。 * @en Function to execute for each element. * @param thisArg * @zh 执行 callbackfn 时用作 this 的值。 * @en Value to use as this when executing callbackfn. */ forEach( callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any ): void; /** * @zh 返回与指定键关联的值,如果找不到键,则返回 undefined。 * @en Returns the value associated with the specified key, or undefined if the key can't be found. * @param key * @zh 要返回其值的元素的键。 * @en The key of the element to return. * @returns * @zh 与指定键关联的值,如果找不到键,则返回 undefined。 * @en The value associated with the specified key, or undefined if the key can't be found. */ get(key: K): V | undefined; /** * @zh 返回一个布尔值,指示具有指定键的元素是否存在。 * @en Returns a boolean indicating whether an element with the specified key exists or not. * @param key * @zh 要在 Map 对象中测试其存在性的元素的键。 * @en The key of the element to test for presence in the Map object. * @returns * @zh 如果具有指定键的元素存在于 Map 对象中,则返回 true;否则返回 false。 * @en Returns true if an element with the specified key exists in the Map object; otherwise false. */ has(key: K): boolean; /** * @zh 在 Map 对象中设置指定键的值。 * @en Sets the value for the specified key in the Map object. * @param key * @zh 要在 Map 对象中添加或更新的元素的键。 * @en The key of the element to add or update in the Map object. * @param value * @zh 要为指定键设置的值。 * @en The value to set for the specified key. * @returns * @zh Map 对象。 * @en The Map object. */ set(key: K, value: V): this; /** * @zh 返回 Map 对象中的键值对数量。 * @en Returns the number of key/value pairs in the Map object. */ readonly size: number; } interface MapConstructor { /** * @zh 创建一个新的 Map 对象。 * @en Creates a new Map object. */ new (): Map<any, any>; /** * @zh 创建一个新的 Map 对象。 * @en Creates a new Map object. * @param entries * @zh 一个可迭代的键值对([key, value])数组。 * @en An array of key-value pairs to initialize the map with. */ new <K, V>(entries?: readonly (readonly [K, V])[] | null): Map<K, V>; /** * @zh 对 Map 原型的引用。 * @en A reference to the Map prototype. */ readonly prototype: Map<any, any>; } declare var Map: MapConstructor; interface ReadonlyMap<K, V> { /** * @zh 对 Map 对象中的每个键值对执行一次提供的函数。 * @en Executes a provided function once for each key/value pair in the Map object. * @param callbackfn * @zh 为每个元素执行的函数。 * @en Function to execute for each element. * @param thisArg * @zh 执行 callbackfn 时用作 this 的值。 * @en Value to use as this when executing callbackfn. */ forEach( callbackfn: (value: V, key: K, map: ReadonlyMap<K, V>) => void, thisArg?: any ): void; /** * @zh 返回与指定键关联的值,如果找不到键,则返回 undefined。 * @en Returns the value associated with the specified key, or undefined if the key can't be found. * @param key * @zh 要返回其值的元素的键。 * @en The key of the element to return. * @returns * @zh 与指定键关联的值,如果找不到键,则返回 undefined。 * @en The value associated with the specified key, or undefined if the key can't be found. */ get(key: K): V | undefined; /** * @zh 返回一个布尔值,指示具有指定键的元素是否存在。 * @en Returns a boolean indicating whether an element with the specified key exists or not. * @param key * @zh 要在 Map 对象中测试其存在性的元素的键。 * @en The key of the element to test for presence in the Map object. * @returns * @zh 如果具有指定键的元素存在于 Map 对象中,则返回 true;否则返回 false。 * @en Returns true if an element with the specified key exists in the Map object; otherwise false. */ has(key: K): boolean; /** * @zh 返回 Map 对象中的键值对数量。 * @en Returns the number of key/value pairs in the Map object. */ readonly size: number; } interface WeakMap<K extends object, V> { /** * @zh 从 WeakMap 对象中移除指定的元素。 * @en Removes the specified element from a WeakMap object. * @param key * @zh 要移除的元素的键。 * @en The key of the element to remove. * @returns * @zh 如果元素成功移除,则返回 true;否则返回 false。 * @en Returns true if an element in the WeakMap object existed and has been removed, or false if the element does not exist. */ delete(key: K): boolean; /** * @zh 返回与指定键关联的值,如果找不到键,则返回 undefined。 * @en Returns the value associated with the specified key, or undefined if the key can't be found. * @param key * @zh 要返回其值的元素的键。 * @en The key of the element to return. * @returns * @zh 与指定键关联的值,如果找不到键,则返回 undefined。 * @en The value associated with the specified key, or undefined if the key can't be found. */ get(key: K): V | undefined; /** * @zh 返回一个布尔值,指示具有指定键的元素是否存在。 * @en Returns a boolean indicating whether an element with the specified key exists or not. * @param key * @zh 要在 WeakMap 对象中测试其存在性的元素的键。 * @en The key of the element to test for presence in the WeakMap object. * @returns * @zh 如果具有指定键的元素存在于 WeakMap 对象中,则返回 true;否则返回 false。 * @en Returns true if an element with the specified key exists in the WeakMap object; otherwise false. */ has(key: K): boolean; /** * @zh 在 WeakMap 对象中设置指定键的值。 * @en Sets the value for the specified key in the WeakMap object. * @param key * @zh 要在 WeakMap 对象中添加或更新的元素的键。 * @en The key of the element to add or update in the WeakMap object. * @param value * @zh 要为指定键设置的值。 * @en The value to set for the specified key. * @returns * @zh WeakMap 对象。 * @en The WeakMap object. */ set(key: K, value: V): this; } interface WeakMapConstructor { /** * @zh 创建一个新的 WeakMap 对象。 * @en Creates a new WeakMap object. * @param entries * @zh 一个可迭代的键值对([key, value])数组。 * @en An array of key-value pairs to initialize the map with. */ new <K extends object, V>(entries?: readonly [K, V][] | null): WeakMap<K, V>; /** * @zh 对 WeakMap 原型的引用。 * @en A reference to the WeakMap prototype. */ readonly prototype: WeakMap<object, any>; } /** * @zh * WeakMap 构造函数。 * @en * WeakMap constructor. */ declare var WeakMap: WeakMapConstructor; /** * @zh * Set 构造函数。 * @en * Set constructor. */ interface Set<T> { /** * @zh 向 Set 对象添加一个新元素。 * @en Appends a new element with a specified value to the end of a Set object. * @param value * @zh 要添加到 Set 对象的元素的值。 * @en The value of the element to add to the Set object. * @returns * @zh Set 对象。 * @en The Set object. */ add(value: T): this; /** * @zh 从 Set 对象中移除所有元素。 * @en Removes all elements from a Set object. */ clear(): void; /** * @zh 从 Set 对象中移除指定的元素。 * @en Removes the specified element from a Set object. * @param value * @zh 要移除的元素的值。 * @en The value of the element to remove. * @returns * @zh 如果元素成功移除,则返回 true;否则返回 false。 * @en Returns true if an element in the Set object existed and has been removed, or false if the element does not exist. */ delete(value: T): boolean; /** * @zh 对 Set 对象中的每个值执行一次提供的函数。 * @en Executes a provided function once for each value in the Set object. * @param callbackfn * @zh 为每个元素执行的函数。 * @en Function to execute for each element. * @param thisArg * @zh 执行 callbackfn 时用作 this 的值。 * @en Value to use as this when executing callbackfn. */ forEach( callbackfn: (value: T, value2: T, set: Set<T>) => void, thisArg?: any ): void; /** * @zh 返回一个布尔值,指示具有指定值的元素是否存在。 * @en Returns a boolean indicating whether an element with the specified value exists or not. * @param value * @zh 要在 Set 对象中测试其存在性的元素的值。 * @en The value of the element to test for presence in the Set object. * @returns * @zh 如果具有指定值的元素存在于 Set 对象中,则返回 true;否则返回 false。 * @en Returns true if an element with the specified value exists in the Set object; otherwise false. */ has(value: T): boolean; /** * @zh 返回 Set 对象中的值的数量。 * @en Returns the number of values in the Set object. */ readonly size: number; } interface SetConstructor { /** * @zh 创建一个新的 Set 对象。 * @en Creates a new Set object. * @param values * @zh 一个可迭代的对象,其元素将添加到新的 Set 中。 * @en An iterable object whose elements will be added to the new Set. */ new <T = any>(values?: readonly T[] | null): Set<T>; /** * @zh 对 Set 原型的引用。 * @en A reference to the Set prototype. */ readonly prototype: Set<any>; } /** * @zh * Set 构造函数。 * @en * Set constructor. */ declare var Set: SetConstructor; interface ReadonlySet<T> { /** * @zh 对 Set 对象中的每个值执行一次提供的函数。 * @en Executes a provided function once for each value in the Set object. * @param callbackfn * @zh 为每个元素执行的函数。 * @en Function to execute for each element. * @param thisArg * @zh 执行 callbackfn 时用作 this 的值。 * @en Value to use as this when executing callbackfn. */ forEach( callbackfn: (value: T, value2: T, set: ReadonlySet<T>) => void, thisArg?: any ): void; /** * @zh 返回一个布尔值,指示具有指定值的元素是否存在。 * @en Returns a boolean indicating whether an element with the specified value exists or not. * @param value * @zh 要在 Set 对象中测试其存在性的元素的值。 * @en The value of the element to test for presence in the Set object. * @returns * @zh 如果具有指定值的元素存在于 Set 对象中,则返回 true;否则返回 false。 * @en Returns true if an element with the specified value exists in the Set object; otherwise false. */ has(value: T): boolean; /** * @zh 返回 Set 对象中的值的数量。 * @en Returns the number of values in the Set object. */ readonly size: number; } interface WeakSet<T extends object> { /** * @zh 向 WeakSet 对象添加一个新对象。 * @en Appends a new object to the end of a WeakSet object. * @param value * @zh 要添加到 WeakSet 对象的对象。 * @en The object to add to the WeakSet object. * @returns * @zh WeakSet 对象。 * @en The WeakSet object. */ add(value: T): this; /** * @zh 从 WeakSet 对象中移除指定的元素。 * @en Removes the specified element from a WeakSet object. * @param value * @zh 要移除的元素的值。 * @en The value of the element to remove. * @returns * @zh 如果元素成功移除,则返回 true;否则返回 false。 * @en Returns true if an element in the WeakSet object existed and has been removed, or false if the element does not exist. */ delete(value: T): boolean; /** * @zh 返回一个布尔值,指示具有指定值的元素是否存在。 * @en Returns a boolean indicating whether an element with the specified value exists or not. * @param value * @zh 要在 WeakSet 对象中测试其存在性的元素的值。 * @en The value of the element to test for presence in the WeakSet object. * @returns * @zh 如果具有指定值的元素存在于 WeakSet 对象中,则返回 true;否则返回 false。 * @en Returns true if an element with the specified value exists in the WeakSet object; otherwise false. */ has(value: T): boolean; } interface WeakSetConstructor { new <T extends object = object>(values?: readonly T[] | null): WeakSet<T>; readonly prototype: WeakSet<object>; } declare var WeakSet: WeakSetConstructor; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ interface Array<T> { /** * @zh 返回数组中满足提供的测试函数的第一个元素的值。否则返回 undefined。 * @en Returns the value of the first element in the array where predicate is true, and undefined otherwise. * @param predicate * @zh 为数组中的每个元素执行的函数。 * @en find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. * @param thisArg * @zh 执行 predicate 时用作 this 的对象。 * @en If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ find<S extends T>( predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any ): S | undefined; /** * @zh 返回数组中满足提供的测试函数的第一个元素的值。否则返回 undefined。 * @en Returns the value of the first element in the array where predicate is true, and undefined otherwise. * @param predicate * @zh 为数组中的每个元素执行的函数。 * @en find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. * @param thisArg * @zh 执行 predicate 时用作 this 的对象。 * @en If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ find( predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any ): T | undefined; /** * @zh 返回数组中满足提供的测试函数的第一个元素的索引。若没有找到对应元素则返回-1。 * @en Returns the index of the first element in the array where predicate is true, and -1 otherwise. * @param predicate * @zh 为数组中的每个元素执行的函数。 * @en find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg * @zh 执行 predicate 时用作 this 的对象。 * @en If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ findIndex( predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any ): number; /** * @zh 用一个固定值填充一个数组中从起始索引到终止索引内的全部元素。 * @en Returns the this object after filling the section identified by start and end with value * @param value * @zh 用来填充数组的值。 * @en value to fill array section with * @param start * @zh 起始索引,默认为0。 * @en index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array. * @param end * @zh 终止索引,默认为 a.length。 * @en index to stop filling the array at. If end is negative, it is treated as length+end. */ fill(value: T, start?: number, end?: number): this; /** * @zh 浅复制数组的一部分到同一数组中的另一个位置,并返回它,不会改变原数组的长度。 * @en Returns the this object after copying a section of the array identified by start and end to the same array starting at position target * @param target * @zh 复制序列到该位置。如果为负数,target 将从末尾开始计算。 * @en If target is negative, it is treated as length+target where length is the length of the array. * @param start * @zh 开始复制元素的起始位置。如果为负数,start 将从末尾开始计算。 * @en If start is negative, it is treated as length+start. If end is negative, it is treated as length+end. * @param end * @zh 停止复制元素的终止位置。如果未指定,copyWithin 将会一直复制到数组末尾。 * @en If not specified, length of the this object is used as its default value. */ copyWithin(target: number, start: number, end?: number): this; } interface ArrayConstructor { /** * @zh 从一个类数组或可迭代对象创建一个新的数组实例。 * @en Creates an array from an array-like object. * @param arrayLike @zh 一个类数组或可迭代对象,用于转换成数组。 @en An array-like object to convert to an array. */ from<T>(arrayLike: ArrayLike<T>): T[]; /** * @zh 从一个类数组或可迭代对象创建一个新的数组实例。 * @en Creates an array from an iterable object. * @param arrayLike @zh 一个类数组或可迭代对象,用于转换成数组。 @en An array-like object to convert to an array. * @param mapfn @zh 对数组每个元素调用的映射函数。 @en A mapping function to call on every element of the array. * @param thisArg @zh 执行 mapfn 时用作 this 的值。 @en Value of 'this' used to invoke the mapfn. */ from<T, U>( arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any ): U[]; /** * @zh 根据一组参数来创建一个新的数组实例。 * @en Returns a new array from a set of elements. * @param items @zh 用于创建新数组对象的元素集合。 @en A set of elements to include in the new array object. */ of<T>(...items: T[]): T[]; } interface DateConstructor { /** * @zh 创建一个表示特定日期和时间的 `Date` 对象。 * @en Creates a `Date` object representing a specific date and time. * @param value @zh 可以是表示自1970年1月1日UTC以来的毫秒数的数字,或者是表示日期的字符串,或者另一个Date对象。 * @en Can be a number representing milliseconds since the Unix Epoch, a string representing a date, or another Date object. */ new (value: number | string | Date): Date; } interface Function { /** * @zh 返回函数的名称。函数名称是只读的,不能更改。 * @en Returns the name of the function. Function names are read-only and can not be changed. */ readonly name: string; } interface Math { /** * @zh 返回一个数字在32位二进制表示形式下的前导零的数量。 * @en Returns the number of leading zero bits in the 32-bit binary representation of a number. * @param x @zh 一个数值表达式。 @en A numeric expression. */ clz32(x: number): number; /** * @zh 返回两个数字的32位整数乘法的结果。 * @en Returns the result of 32-bit multiplication of two numbers. * @param x @zh 第一个数。 @en First number. * @param y @zh 第二个数。 @en Second number. */ imul(x: number, y: number): number; /** * @zh 返回一个数字的符号,表示这个数字是正数、负数还是零。 * @en Returns the sign of the x, indicating whether x is positive, negative or zero. * @param x @zh 要测试的数值表达式。 @en The numeric expression to test. */ sign(x: number): number; /** * @zh 返回一个数字以10为底的对数。 * @en Returns the base 10 logarithm of a number. * @param x @zh 一个数值表达式。 @en A numeric expression. */ log10(x: number): number; /** * @zh 返回一个数字以2为底的对数。 * @en Returns the base 2 logarithm of a number. * @param x @zh 一个数值表达式。 @en A numeric expression. */ log2(x: number): number; /** * @zh 返回一个数字加1后的自然对数。 * @en Returns the natural logarithm of 1 + x. * @param x @zh 一个数值表达式。 @en A numeric expression. */ log1p(x: number): number; /** * @zh 返回 e^x - 1 的结果。 * @en Returns the result of (e^x - 1). * @param x @zh 一个数值表达式。 @en A numeric expression. */ expm1(x: number): number; /** * @zh 返回一个数字的双曲余弦值。 * @en Returns the hyperbolic cosine of a number. * @param x @zh 一个包含以弧度为单位的角度的数值表达式。 @en A numeric expression that contains an angle measured in radians. */ cosh(x: number): number; /** * @zh 返回一个数字的双曲正弦值。 * @en Returns the hyperbolic sine of a number. * @param x @zh 一个包含以弧度为单位的角度的数值表达式。 @en A numeric expression that contains an angle measured in radians. */ sinh(x: number): number; /** * @zh 返回一个数字的双曲正切值。 * @en Returns the hyperbolic tangent of a number. * @param x @zh 一个包含以弧度为单位的角度的数值表达式。 @en A numeric expression that contains an angle measured in radians. */ tanh(x: number): number; /** * @zh 返回一个数字的反双曲余弦值。 * @en Returns the inverse hyperbolic cosine of a number. * @param x @zh 一个包含以弧度为单位的角度的数值表达式。 @en A numeric expression that contains an angle measured in radians. */ acosh(x: number): number; /** * @zh 返回一个数字的反双曲正弦值。 * @en Returns the inverse hyperbolic sine of a number. * @param x @zh 一个包含以弧度为单位的角度的数值表达式。 @en A numeric expression that contains an angle measured in radians. */ asinh(x: number): number; /** * @zh 返回一个数字的反双曲正切值。 * @en Returns the inverse hyperbolic tangent of a number. * @param x @zh 一个包含以弧度为单位的角度的数值表达式。 @en A numeric expression that contains an angle measured in radians. */ atanh(x: number): number; /** * @zh 返回其参数平方和的平方根。 * @en Returns the square root of the sum of squares of its arguments. * @param values @zh 用于计算平方根的值。 @en Values to compute the square root for. */ hypot(...values: number[]): number; /** * @zh 返回一个数的整数部分,去除任何小数位数。 * @en Returns the integral part of a numeric expression, x, removing any fractional digits. * @param x @zh 一个数值表达式。 @en A numeric expression. */ trunc(x: number): number; /** * @zh 返回一个数的最近的单精度浮点数表示。 * @en Returns the nearest single precision float representation of a number. * @param x @zh 一个数值表达式。 @en A numeric expression. */ fround(x: number): number; /** * @zh 返回一个数的立方根。 * @en Returns an implementation-dependent approximation to the cube root of number. * @param x @zh 一个数值表达式。 @en A numeric expression. */ cbrt(x: number): number; } interface NumberConstructor { /** * @zh 两个可表示数字之间的最小间隔。 * @en The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 that is representable as a Number value. */ readonly EPSILON: number; /** * @zh 判断传入的值是否为有限数。 * @en Returns true if passed value is finite. * @param number @zh 一个数值。 @en A numeric value. */ isFinite(number: number): boolean; /** * @zh 判断传入的值是否为整数。 * @en Returns true if the value passed is an integer, false otherwise. * @param number @zh 一个数值。 @en A numeric value. */ isInteger(number: number): boolean; /** * @zh 判断传入的值是否为 NaN。 * @en Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). * @param number @zh 一个数值。 @en A numeric value. */ isNaN(number: number): boolean; /** * @zh 判断传入的值是否为安全整数。 * @en Returns true if the value passed is a safe integer. * @param number @zh 一个数值。 @en A numeric value. */ isSafeInteger(number: number): boolean; /** * @zh 表示在 JavaScript 中最大的安全整数(2^53 - 1)。 * @en The value of the largest integer n such that n and n + 1 are both exactly representable as a Number value. */ readonly MAX_SAFE_INTEGER: number; /** * @zh 表示在 JavaScript 中最小的安全整数(-(2^53 - 1))。 * @en The value of the smallest integer n such that n and n − 1 are both exactly representable as a Number value. */ readonly MIN_SAFE_INTEGER: number; /** * @zh 将字符串转换为浮点数。 * @en Converts a string to a floating-point number. * @param string @zh 包含浮点数的字符串。 @en A string that contains a floating-point number. */ parseFloat(string: string): number; /** * @zh 将字符串转换为整数。 * @en Converts a string to an integer. * @param string @zh 要转换为数字的字符串。 @en A string to convert into a number. * @param radix @zh 用于解析数字的基数,介于2和36之间。 @en A value between 2 and 36 that specifies the base of the number in numString. */ parseInt(string: string, radix?: number): number; } interface ObjectConstructor { /** * @zh 将一个或多个源对象的所有可枚举自有属性的值复制到目标对象。返回目标对象。 * @en Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object. * @param target * @zh 要复制到的目标对象。 * @en The target object to copy to. * @param source * @zh 要从中复制属性的源对象。 * @en The source object from which to copy properties. */ assign<T, U>(target: T, source: U): T & U; /** * @zh 将一个或多个源对象的所有可枚举自有属性的值复制到目标对象。返回目标对象。 * @en Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object. * @param target * @zh 要复制到的目标对象。 * @en The target object to copy to. * @param source1 * @zh 第一个要从中复制属性的源对象。 * @en The first source object from which to copy properties. * @param source2 * @zh 第二个要从中复制属性的源对象。 * @en The second source object from which to copy properties. */ assign<T, U, V>(target: T, source1: U, source2: V): T & U & V; /** * @zh 将一个或多个源对象的所有可枚举自有属性的值复制到目标对象。返回目标对象。 * @en Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object. * @param target * @zh 要复制到的目标对象。 * @en The target object to copy to. * @param source1 * @zh 第一个要从中复制属性的源对象。 * @en The first source object from which to copy properties. * @param source2 * @zh 第二个要从中复制属性的源对象。 * @en The second source object from which to copy properties. * @param source3 * @zh 第三个要从中复制属性的源对象。 * @en The third source object from which to copy properties. */ assign<T, U, V, W>( target: T, source1: U, source2: V, source3: W ): T & U & V & W; /** * @zh 将一个或多个源对象的所有可枚举自有属性的值复制到目标对象。返回目标对象。 * @en Copy the values of all of the enumerable own properties from one or more source objects to a target object. Returns the target object. * @param target * @zh 要复制到的目标对象。 * @en The target object to copy to. * @param sources * @zh 一系列源对象。 */ assign(target: object, ...sources: any[]): any; /** * @zh 返回一个包含给定对象所有自有符号属性的数组。 * @en Returns an array of all symbol properties found directly upon a given object. * @param o @zh 要返回其符号属性的对象。 @en The object whose symbol properties are to be returned. */ getOwnPropertySymbols(o: any): symbol[]; /** * @zh 返回一个对象的可枚举字符串属性和方法的名称。 * @en Returns the names of the enumerable string properties and methods of an object. * @param o * @zh 包含属性和方法的对象。这可以是您创建的对象或现有的文档对象模型 (DOM) 对象。 * @en Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object. */ keys(o: {}): string[]; /** * @zh 如果值是相同的值,则返回 true,否则返回 false。 * @en Returns true if the values are the same value, false otherwise. * @param value1 * @zh 第一个值。 * @en The first value. * @param value2 * @zh 第二个值。 * @en The second value. */ is(value1: any, value2: any): boolean; /** * @zh 将指定对象 o 的原型设置为对象 proto 或 null。返回对象 o。 * @en Sets the prototype of a specified object o to object proto or null. Returns the object o. * @param o * @zh 要更改其原型的对象。 * @en The object to change its prototype. * @param proto * @zh 新原型的值或 null。 * @en The value of the new prototype or null. */ setPrototypeOf(o: any, proto: object | null): any; } interface ReadonlyArray<T> { /** * @zh 返回数组中第一个满足 predicate 函数的元素的值,否则返回 undefined。 * @en Returns the value of the first element in the array where predicate is true, and undefined otherwise. * @param predicate * @zh find 为数组中的每个元素(按升序)调用一次 predicate 函数,直到找到一个 predicate 返回 true 的元素。如果找到这样的元素,find 会立即返回该元素的值。否则,find 返回 undefined。 * @en find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined. * @param thisArg * @zh 如果提供,它将用作每次调用 predicate 时的 this 值。如果未提供,则使用 undefined。 * @en If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ find<S extends T>( predicate: ( this: void, value: T, index: number, obj: readonly T[] ) => value is S, thisArg?: any ): S | undefined; find( predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any ): T | undefined; /** * @zh 返回数组中第一个满足 predicate 函数的元素的索引,否则返回 -1。 * @en Returns the index of the first element in the array where predicate is true, and -1 otherwise. * @param predicate * @zh findIndex 为数组中的每个元素(按升序)调用一次 predicate 函数,直到找到一个 predicate 返回 true 的元素。如果找到这样的元素,findIndex 会立即返回该元素的索引。否则,findIndex 返回 -1。 * @en findIndex calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1. * @param thisArg * @zh 如果提供,它将用作每次调用 predicate 时的 this 值。如果未提供,则使用 undefined。 * @en If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead. */ findIndex( predicate: (value: T, index: number, obj: readonly T[]) => unknown, thisArg?: any ): number; } interface RegExp { /** * @zh 返回一个表示当前正则表达式标志的字符串。此字段为只读。 * @en Returns a string indicating the flags of the regular expression in question. This field is read-only. * @zh 字符串中的字符按以下顺序排列和连接: * @en The characters in this string are sequenced and concatenated in the following order: * * - "g" for global * - "i" for ignoreCase * - "m" for multiline * - "u" for unicode * - "y" for sticky * * @zh 如果没有设置任何标志,则值为空字符串。 * @en If no flags are set, the value is the empty string. */ readonly flags: string; /** * @zh 返回一个布尔值,表示正则表达式是否使用了粘性标志 (y)。默认为 false。只读。 * @en Returns a Boolean value indicating the state of the sticky flag (y) used with a regular expression. Default is false. Read-only. */ readonly sticky: boolean; /** * @zh 返回一个布尔值,表示正则表达式是否使用了 Unicode 标志 (u)。默认为 false。只读。 * @en Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular expression. Default is false. Read-only. */ readonly unicode: boolean; } interface RegExpConstructor { /** * @zh 创建一个新的正则表达式对象。 * @en Creates a new regular expression object. * @param pattern * @zh 正则表达式的模式或字符串。 * @en The pattern or string for the regular expression. * @param flags * @zh 一个包含标志的字符串。 * @en A string containing the flags. */ new (pattern: RegExp | string, flags?: string): RegExp; /** * @zh 创建一个新的正则表达式对象。 * @en Creates a new regular expression object. * @param pattern * @zh 正则表达式的模式或字符串。 * @en The pattern or string for the regular expression. * @param flags * @zh 一个包含标志的字符串。 * @en A string containing the flags. */ (pattern: RegExp | string, flags?: string): RegExp; } interface String { /** * @zh 返回一个非负整数,该整数是位于字符串中指定位置的 UTF-16 编码代码点的值。 * @en Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point value of the UTF-16 encoded code point starting at the string element at position pos in the String resulting from converting this object to a String. * @zh 如果该位置没有元素,则结果为 undefined。 * @en If there is no element at that position, the result is undefined. * @zh 如果在 pos 处没有有效的 UTF-16 代理对开始,则结果是 pos 处的代码单元。 * @en If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. */ codePointAt(pos: number): number | undefined; /** * @zh 如果 searchString 作为转换此对象为字符串的结果的子字符串出现,并且出现位置大于或等于 position,则返回 true;否则返回 false。 * @en Returns true if searchString appears as a substring of the result of converting this object to a String, at one or more positions that are greater than or equal to position; otherwise, returns false. * @param searchString * @zh 搜索字符串。 * @en search string * @param position * @zh 如果 position 未定义,则假定为 0,以便搜索整个字符串。 * @en If position is undefined, 0 is assumed, so as to search all of the String. */ includes(searchString: string, position?: number): boolean; /** * @zh 如果 searchString 转换为字符串的元素序列与此对象(转换为字符串)从 endPosition – length(this) 开始的相应元素相同,则返回 true。否则返回 false。 * @en Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at endPosition – length(this). Otherwise returns false. */ endsWith(searchString: string, endPosition?: number): boolean; /** * @zh 返回将字符串规范化为 Unicode 标准附件 #15 中指定的范式(form)后的字符串值。 * @en Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. * @param form * @zh 可用值为 "NFC", "NFD", "NFKC", 或 "NFKD"。如果未指定,默认为 "NFC"。 * @en Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default is "NFC" */ normalize(form: "NFC" | "NFD" | "NFKC" | "NFKD"): string; /** * @zh 返回将字符串规范化为 Unicode 标准附件 #15 中指定的范式(form)后的字符串值。 * @en Returns the String value result of normalizing the string into the normalization form named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. * @param form * @zh 可用值为 "NFC", "NFD", "NFKC", 或 "NFKD"。如果未指定,默认为 "NFC"。 * @en Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default is "NFC" */ normalize(form?: string): string; /** * @zh 返回一个由 count 个副本连接而成的字符串值。如果 count 为 0,则返回空字符串。 * @en Returns a String value that is made from count copies appended together. If count is 0, the empty string is returned. * @param count * @zh 要附加的副本数。 * @en number of copies to append */ repeat(count: number): string; /** * @zh 如果 searchString 转换为字符串的元素序列与此对象(转换为字符串)从 position 开始的相应元素相同,则返回 true。否则返回 false。 * @en Returns true if the sequence of elements of searchString converted to a String is the same as the corresponding elements of this object (converted to a String) starting at position. Otherwise returns false. */ startsWith(searchString: string, position?: number): boolean; /** * @zh 返回一个 <a> HTML 锚点元素,并将其 name 属性设置为文本值。 * @en Returns an <a> HTML anchor element and sets the name attribute to the text value. * @param name */ anchor(name: string): string; /** * @zh 返回一个 <big> HTML 元素。 * @en Returns a <big> HTML element. */ big(): string; /** * @zh 返回一个 <blink> HTML 元素。 * @en Returns a <blink> HTML element. */ blink(): string; /** * @zh 返回一个 <b> HTML 元素。 * @en Returns a <b> HTML element. */ bold(): string; /** * @zh 返回一个 <tt> HTML 元素。 * @en Returns a <tt> HTML element. */ fixed(): string; /** * @zh 返回一个 <font> HTML 元素并设置其 color 属性值。 * @en Returns a <font> HTML element and sets the color attribute value. */ fontcolor(color: string): string; /** * @zh 返回一个 <font> HTML 元素并设置其 size 属性值。 * @en Returns a <font> HTML element and sets the size attribute value. */ fontsize(size: number): string; /** * @zh 返回一个 <font> HTML 元素并设置其 size 属性值。 * @en Returns a <font> HTML element and sets the size attribute value. */ fontsize(size: string): string; /** * @zh 返回一个 <i> HTML 元素。 * @en Returns an <i> HTML element. */ italics(): string; /** * @zh 返回一个 <a> HTML 元素并设置其 href 属性值。 * @en Returns an <a> HTML element and sets the href attribute value. */ link(url: string): string; /** * @zh 返回一个 <small> HTML 元素。 * @en Returns a <small> HTML element. */ small(): string; /** * @zh 返回一个 <strike> HTML 元素。 * @en Returns a <strike> HTML element. */ strike(): string; /** * @zh 返回一个 <sub> HTML 元素。 * @en Returns a <sub> HTML element. */ sub(): string; /** * @zh 返回一个 <sup> HTML 元素。 * @en Returns a <sup> HTML element. */ sup(): string; } interface StringConstructor { /** * @zh 返回一个字符串值,其元素按顺序是列表元素中的元素。如果长度为 0,则返回空字符串。 * @en Return the String value whose elements are, in order, the elements in the List elements. If length is 0, the empty string is returned. */ fromCodePoint(...codePoints: number[]): string; /** * @zh String.raw 旨在用作标记模板字符串的标记函数。当这样调用时,第一个参数将是一个格式正确的模板调用站点对象,其余参数将包含替换值。 * @en String.raw is intended for use as a tag function of a Tagged Template String. When called as such the first argument will be a well formed template call site object and the rest parameter will contain the substitution values. * @param template * @zh 一个格式正确的模板字符串调用站点表示。 * @en A well-formed template string call site representation. * @param substitutions * @zh 一组替换值。 * @en A set of substitution values. */ raw(template: TemplateStringsArray, ...substitutions: any[]): string; } /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ interface Generator<T = unknown, TReturn = any, TNext = unknown> extends Iterator<T, TReturn, TNext> { /** * @zh 移至生成器的下一个值。 * @en Moves to the next value in the generator. */ next(...args: [] | [TNext]): IteratorResult<T, TReturn>; /** * @zh 结束生成器并返回值。 * @en Ends the generator and returns a value. */ return(value: TReturn): IteratorResult<T, TReturn>; /** * @zh 在生成器中引发错误。 * @en Throws an error in the generator. */ throw(e: any): IteratorResult<T, TReturn>; /** * @zh 返回生成器自身的迭代器。 * @en Returns the generator's own iterator. */ [Symbol.iterator](): Generator<T, TReturn, TNext>; } interface GeneratorFunction { /** * @zh 创建一个新的生成器对象。 * @en Creates a new Generator object. * @param args * @zh 函数接受的参数列表。 * @en A list of arguments the function accepts. */ new (...args: any[]): Generator; /** * @zh 创建一个新的生成器对象。 * @en Creates a new Generator object. * @param args * @zh 函数接受的参数列表。 * @en A list of arguments the function accepts. */ (...args: any[]): Generator; /** * @zh 参数的长度。 * @en The length of the arguments. */ readonly length: number; /** * @zh 返回函数的名称。 * @en Returns the name of the function. */ readonly name: string; /** * @zh 对原型的引用。 * @en A reference to the prototype. */ readonly prototype: Generator; } interface GeneratorFunctionConstructor { /** * @zh 创建一个新的生成器函数。 * @en Creates a new Generator function. * @param args * @zh 函数接受的参数列表。 * @en A list of arguments the function accepts. */ new (...args: string[]): GeneratorFunction; /** * @zh 创建一个新的生成器函数。 * @en Creates a new Generator function. * @param args * @zh 函数接受的参数列表。 * @en A list of arguments the function accepts. */ (...args: string[]): GeneratorFunction; /** * @zh 参数的长度。 * @en The length of the arguments. */ readonly length: number; /** * @zh 返回函数的名称。 * @en Returns the name of the function. */ readonly name: string; /** * @zh 对原型的引用。 * @en A reference to the prototype. */ readonly prototype: GeneratorFunction; } /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ interface SymbolConstructor { /** * @zh 一个返回对象默认迭代器的方法。由 for-of 语句的语义调用。 * @en A method that returns the default iterator for an object. Called by the semantics of the for-of statement. */ readonly iterator: symbol; } interface IteratorYieldResult<TYield> { /** * @zh 表示迭代器是否完成。 * @en Indicates whether the iterator is done. */ done?: false; /** * @zh 迭代器返回的值。 * @en The value returned by the iterator. */ value: TYield; } interface IteratorReturnResult<TReturn> { /** * @zh 表示迭代器是否完成。 * @en Indicates whether the iterator is done. */ done: true; /** * @zh 迭代器返回的值。 * @en The value returned by the iterator. */ value: TReturn; } type IteratorResult<T, TReturn = any> = | IteratorYieldResult<T> | IteratorReturnResult<TReturn>; interface Iterator<T, TReturn = any, TNext = undefined> { /** * @zh 移至迭代器的下一个值。 * @en Moves to the next value in the iterator. */ next(...args: [] | [TNext]): IteratorResult<T, TReturn>; /** * @zh 结束迭代器并返回值。 * @en Ends the iterator and returns a value. */ return?(value?: TReturn): IteratorResult<T, TReturn>; /** * @zh 在迭代器中引发错误。 * @en Throws an error in the iterator. */ throw?(e?: any): IteratorResult<T, TReturn>; } interface Iterable<T> { /** * @zh 返回此对象的迭代器。 * @en Returns an iterator for this object. */ [Symbol.iterator](): Iterator<T>; } interface IterableIterator<T> extends Iterator<T> { /** * @zh 返回此对象的可迭代迭代器。 * @en Returns an iterable iterator for this object. */ [Symbol.iterator](): IterableIterator<T>; } interface Array<T> { /** * @zh 迭代器 * @en Iterator */ [Symbol.iterator](): IterableIterator<T>; /** * @zh 返回一个新的Array Iterator对象,该对象包含数组中每个索引的键/值对。 * @en Returns an iterable of key, value pairs for every entry in the array */ entries(): IterableIterator<[number, T]>; /** * @zh 返回一个新的Array迭代器,它包含数组中每个索引的键。 * @en Returns an iterable of keys in the array */ keys(): IterableIterator<number>; /** * @zh 返回一个新的Array Iterator对象,该对象包含数组中每个索引的值。 * @en Returns an iterable of values in the array */ values(): IterableIterator<T>; } interface ArrayConstructor { /** * @zh 从一个可迭代对象创建一个数组。 * @