@aitianyu.cn/types 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/README.md +44 -0
  2. package/dist/lib/coding/Error.js +16 -6
  3. package/dist/lib/coding/Path.js +41 -20
  4. package/dist/lib/core/Environment.js +14 -0
  5. package/dist/lib/core/Errors.js +34 -13
  6. package/dist/lib/core/Language.js +60 -7
  7. package/dist/lib/core/Log.js +34 -2
  8. package/dist/lib/core/TypeConvertion.js +20 -0
  9. package/dist/lib/core/object/ArrayHelper.js +15 -4
  10. package/dist/lib/core/object/Bytes.js +8 -4
  11. package/dist/lib/core/object/Calculater.js +109 -44
  12. package/dist/lib/core/object/DataView.js +13 -4
  13. package/dist/lib/core/object/Integer.js +57 -36
  14. package/dist/lib/core/object/Json.js +22 -10
  15. package/dist/lib/core/object/ObjectHelper.js +38 -14
  16. package/dist/lib/core/object/StringHelper.js +35 -8
  17. package/dist/lib/index.js +47 -6
  18. package/dist/lib/security/Base32.js +22 -13
  19. package/dist/lib/security/Guid.js +18 -1
  20. package/dist/lib/security/Hash.js +10 -1
  21. package/dist/lib/security/QRCode.js +16 -4
  22. package/dist/lib/security/RSA.js +33 -20
  23. package/dist/lib/security/SHA.js +25 -15
  24. package/dist/lib/security/TOTP.js +31 -9
  25. package/dist/lib/types/AreaCode.js +140 -131
  26. package/dist/lib/types/Exception.js +17 -3
  27. package/dist/lib/types/Logs.js +13 -7
  28. package/dist/lib/types/PathBase.js +43 -23
  29. package/dist/lib/types/Security.js +6 -1
  30. package/dist/lib/types/TMap.js +48 -30
  31. package/dist/types/coding/Error.d.ts +16 -6
  32. package/dist/types/coding/Path.d.ts +45 -21
  33. package/dist/types/core/Environment.d.ts +14 -0
  34. package/dist/types/core/Errors.d.ts +34 -13
  35. package/dist/types/core/Language.d.ts +33 -7
  36. package/dist/types/core/Log.d.ts +34 -2
  37. package/dist/types/core/TypeConvertion.d.ts +20 -0
  38. package/dist/types/core/interface/ITJSON.d.ts +11 -0
  39. package/dist/types/core/interface/ITianyuType.d.ts +11 -0
  40. package/dist/types/core/object/ArrayHelper.d.ts +15 -4
  41. package/dist/types/core/object/Bytes.d.ts +8 -4
  42. package/dist/types/core/object/Calculater.d.ts +38 -10
  43. package/dist/types/core/object/DataView.d.ts +13 -4
  44. package/dist/types/core/object/Integer.d.ts +57 -36
  45. package/dist/types/core/object/Json.d.ts +22 -10
  46. package/dist/types/core/object/ObjectHelper.d.ts +38 -14
  47. package/dist/types/core/object/StringHelper.d.ts +35 -8
  48. package/dist/types/index.d.ts +44 -0
  49. package/dist/types/security/Base32.d.ts +31 -18
  50. package/dist/types/security/Guid.d.ts +19 -1
  51. package/dist/types/security/Hash.d.ts +10 -1
  52. package/dist/types/security/QRCode.d.ts +16 -4
  53. package/dist/types/security/RSA.d.ts +51 -28
  54. package/dist/types/security/SHA.d.ts +25 -15
  55. package/dist/types/security/TOTP.d.ts +31 -9
  56. package/dist/types/types/AreaCode.d.ts +140 -1
  57. package/dist/types/types/Exception.d.ts +17 -3
  58. package/dist/types/types/Logs.d.ts +59 -30
  59. package/dist/types/types/Object.d.ts +16 -7
  60. package/dist/types/types/PathBase.d.ts +43 -23
  61. package/dist/types/types/Security.d.ts +21 -8
  62. package/dist/types/types/TMap.d.ts +48 -30
  63. package/dist/types/types/Types.d.ts +42 -10
  64. package/doc/en/README.md +372 -0
  65. package/doc/zh/README.md +372 -0
  66. package/package.json +3 -2
@@ -1,64 +1,93 @@
1
1
  /**@format */
2
- /** Tianyu Log Level */
2
+ /**
3
+ * Tianyu Log Level Enum.
4
+ * Defines the severity levels for log messages.
5
+ *
6
+ * Tianyu 日志级别枚举。
7
+ * 定义日志消息的严重程度级别。
8
+ */
3
9
  export declare enum LogLevel {
4
- /** Debug mode log */
10
+ /** Debug level for development/diagnostic messages. / 调试级别——用于开发或诊断信息。 */
5
11
  DEBUG = 0,
6
- /** error msg */
12
+ /** Error level — for recoverable error messages. / 错误级别——用于可恢复的错误信息。 */
7
13
  ERROR = 1,
8
- /** fatal error msg */
14
+ /** Fatal level for critical, unrecoverable errors. / 致命级别——用于严重且无法恢复的错误。 */
9
15
  FATAL = 2,
10
- /** info log */
16
+ /** Info level — for general informational messages. / 信息级别——用于一般性通知信息。 */
11
17
  INFO = 3,
12
- /** warning log */
18
+ /** Warning level — for potentially problematic situations. / 警告级别——用于潜在问题的提示信息。 */
13
19
  WARNING = 4,
14
- /** default log */
20
+ /** Default log level — for plain output with no special classification. / 默认日志级别——无特殊分类的普通输出。 */
15
21
  LOG = 5
16
22
  }
17
- /** Tianyu Log Interface */
23
+ /**
24
+ * Tianyu Log Interface.
25
+ * Defines the contract for the logging instance.
26
+ *
27
+ * Tianyu 日志接口。
28
+ * 定义日志实例的方法契约。
29
+ */
18
30
  export interface ILog {
19
31
  /**
20
- * Write a console log with specified log level
32
+ * Write a console log with a specified log level.
33
+ * 以指定日志级别写入一条控制台日志。
21
34
  *
22
- * @param msg the message body
23
- * @param level the console log level, if not be specified, to print as default log
24
- * @param timer a boolean value indicates whether needs to add a timestamp for the log
35
+ * @param msg the message body / 日志内容
36
+ * @param level the console log level; defaults to INFO if not specified / 日志级别,未指定时默认为 INFO
37
+ * @param timer whether to prepend a timestamp to the log / 是否在日志前添加时间戳
25
38
  */
26
39
  log(msg: string, level?: LogLevel, timer?: boolean): void;
27
40
  /**
28
- * Write a console info log
29
- * @param msg the message body
30
- * @param timer a boolean value indicates whether needs to add a timestamp for the log
41
+ * Write a console info log.
42
+ * 写入一条 INFO 级别的控制台日志。
43
+ *
44
+ * @param msg the message body / 日志内容
45
+ * @param timer whether to prepend a timestamp / 是否添加时间戳
31
46
  */
32
47
  info(msg: string, timer?: boolean): void;
33
48
  /**
34
- * Write a console warning log
35
- * @param msg the message body
36
- * @param timer a boolean value indicates whether needs to add a timestamp for the log
49
+ * Write a console warning log.
50
+ * 写入一条 WARNING 级别的控制台日志。
51
+ *
52
+ * @param msg the message body / 日志内容
53
+ * @param timer whether to prepend a timestamp / 是否添加时间戳
37
54
  */
38
55
  warn(msg: string, timer?: boolean): void;
39
56
  /**
40
- * Write a console debug log
41
- * @param msg the message body
42
- * @param timer a boolean value indicates whether needs to add a timestamp for the log
57
+ * Write a console debug log.
58
+ * 写入一条 DEBUG 级别的控制台日志。
59
+ *
60
+ * @param msg the message body / 日志内容
61
+ * @param timer whether to prepend a timestamp / 是否添加时间戳
43
62
  */
44
63
  debug(msg: string, timer?: boolean): void;
45
64
  /**
46
- * Write a console error message
47
- * @param msg the message body
48
- * @param timer a boolean value indicates whether needs to add a timestamp for the log
65
+ * Write a console error message.
66
+ * 写入一条 ERROR 级别的控制台日志。
67
+ *
68
+ * @param msg the message body / 日志内容
69
+ * @param timer whether to prepend a timestamp / 是否添加时间戳
49
70
  */
50
71
  error(msg: string, timer?: boolean): void;
51
72
  /**
52
- * Write a console fatal message
53
- * @param msg the message body
54
- * @param timer a boolean value indicates whether needs to add a timestamp for the log
73
+ * Write a console fatal message.
74
+ * 写入一条 FATAL 级别的控制台日志。
75
+ *
76
+ * @param msg the message body / 日志内容
77
+ * @param timer whether to prepend a timestamp / 是否添加时间戳
55
78
  */
56
79
  fatal(msg: string, timer?: boolean): void;
57
80
  }
58
- /** Tianyu Performance recorder */
81
+ /**
82
+ * Tianyu Performance Recorder.
83
+ * Holds the start information for a performance measurement session.
84
+ *
85
+ * Tianyu 性能记录器。
86
+ * 保存一次性能测量会话的起始信息。
87
+ */
59
88
  export interface IPerfRecorder {
60
- /** the recording id */
89
+ /** Unique identifier for this performance recording session. / 本次性能记录会话的唯一标识符。 */
61
90
  id: string;
62
- /** the start time number */
91
+ /** The timestamp (ms since epoch) when the recording started. / 记录开始时的时间戳(毫秒)。 */
63
92
  start: number;
64
93
  }
@@ -1,18 +1,27 @@
1
1
  /**@format */
2
2
  import { TMap } from "./TMap";
3
3
  import { PathBase } from "./PathBase";
4
- /** Tianyu Object calculated different item */
4
+ /**
5
+ * Describes a single field-level difference between two object snapshots.
6
+ * 描述两个对象快照之间某个字段级别的差异信息。
7
+ */
5
8
  export interface IObjectDiffInfo {
6
- /** different item path */
9
+ /** The path string that locates the changed field within the object. / 定位对象中变更字段的路径字符串。 */
7
10
  path: string;
8
- /** the old value of this path */
11
+ /** The previous value at this path before the change. / 变更前此路径处的旧值。 */
9
12
  old: any;
10
- /** the new value of this path */
13
+ /** The new value at this path after the change. / 变更后此路径处的新值。 */
11
14
  new: any;
12
- /** does the change be deletion */
15
+ /** Present and true when this change represents a field deletion. / 当此变更表示字段删除时,该属性存在且为 true。 */
13
16
  deleted?: true;
14
- /** does the change be adding */
17
+ /** Present and true when this change represents a new field addition. / 当此变更表示字段新增时,该属性存在且为 true。 */
15
18
  added?: true;
16
19
  }
17
- /** Different items map */
20
+ /**
21
+ * A map of all field-level differences keyed by their path.
22
+ * Used as the return type of ObjectCalculater.calculateDiff().
23
+ *
24
+ * 以路径为键存储所有字段级差异的映射表。
25
+ * 作为 ObjectCalculater.calculateDiff() 的返回类型使用。
26
+ */
18
27
  export type ObjectDiffMap = TMap<PathBase, IObjectDiffInfo>;
@@ -1,24 +1,36 @@
1
1
  /**@format */
2
2
  import { IComparable } from "./Types";
3
- /** Path base class */
3
+ /**
4
+ * Abstract base class for path representations.
5
+ * Stores an ordered list of directory segments and provides path manipulation utilities.
6
+ * Implements IComparable so instances can be used as TMap keys.
7
+ *
8
+ * 路径表示的抽象基类。
9
+ * 以有序列表存储目录段,并提供路径操作工具方法。
10
+ * 实现 IComparable 接口,使实例可用作 TMap 的键。
11
+ */
4
12
  export declare class PathBase implements IComparable {
13
+ /** Internal array of directory segment strings. / 内部存储目录段字符串的数组。 */
5
14
  protected _dirs: string[];
6
15
  /**
7
- * Create a Path instance by specified dirs
16
+ * Create a PathBase instance from an optional array of directory segments.
17
+ * 通过可选的目录段数组创建 PathBase 实例。
8
18
  *
9
- * @param dirs the specified directories
19
+ * @param dirs the directory segments to initialize with / 用于初始化的目录段数组
10
20
  */
11
21
  constructor(dirs?: string[]);
12
22
  /**
13
- * Convert the path instance to string
23
+ * Convert the path to a forward-slash-separated string.
24
+ * 将路径转换为以正斜杠分隔的字符串。
14
25
  *
15
- * @returns return the fromatted string
26
+ * @returns the formatted path string, or "" if empty / 格式化后的路径字符串,为空时返回 ""
16
27
  */
17
28
  toString(): string;
18
29
  /**
19
- * Iterator of path directories
30
+ * Return an iterator over the directory segments in order.
31
+ * 按顺序返回目录段的迭代器。
20
32
  *
21
- * @returns return an iterator
33
+ * @returns an iterator object / 迭代器对象
22
34
  */
23
35
  [Symbol.iterator](): {
24
36
  next: () => {
@@ -27,50 +39,58 @@ export declare class PathBase implements IComparable {
27
39
  };
28
40
  };
29
41
  /**
30
- * Get a directories array deep copy
42
+ * Get a shallow copy of the internal directory segments array.
43
+ * 获取内部目录段数组的浅拷贝。
31
44
  *
32
- * @returns return directories
45
+ * @returns a copy of the directories array / 目录数组的副本
33
46
  */
34
47
  getDirs(): string[];
35
48
  /**
36
- * Get a number that indicates the directories count
49
+ * Get the number of directory segments in this path.
50
+ * 获取当前路径中目录段的数量。
37
51
  *
38
- * @returns return the directories count
52
+ * @returns the segment count / 目录段数量
39
53
  */
40
54
  length(): number;
41
55
  /**
42
- * Append a new directory to the end of path
56
+ * Append a new directory segment to the end of the path.
57
+ * 在路径末尾追加一个新的目录段。
43
58
  *
44
- * @param dir the new directory name
45
- * @returns return the new directories count
59
+ * @param dir the directory name to append / 要追加的目录名
60
+ * @returns the new total segment count / 新的目录段总数
46
61
  */
47
62
  append(dir: string): number;
48
63
  /**
49
- * Clean all the pathes
64
+ * Remove all directory segments, resetting the path to empty.
65
+ * 清除所有目录段,将路径重置为空。
50
66
  */
51
67
  clear(): void;
52
68
  /**
53
- * Remove the end directory of the path instance and return it
69
+ * Remove and return the last directory segment.
70
+ * 移除并返回最后一个目录段。
54
71
  *
55
- * @returns return the end of directory
72
+ * @returns the last directory segment, or undefined if empty / 最后一个目录段,为空时返回 undefined
56
73
  */
57
74
  pop(): string | undefined;
58
75
  /**
59
- * Remove the first directory of the path instance and return it
76
+ * Remove and return the first directory segment.
77
+ * 移除并返回第一个目录段。
60
78
  *
61
- * @returns return the first directory
79
+ * @returns the first directory segment, or undefined if empty / 第一个目录段,为空时返回 undefined
62
80
  */
63
81
  shift(): string | undefined;
64
82
  /**
65
- * Convert the path instance to string for object comparing
83
+ * IComparable implementation returns the string form for object comparison.
84
+ * IComparable 实现——返回用于对象比较的字符串形式。
66
85
  *
67
- * @returns return the comparable string
86
+ * @returns the comparable string / 可比较字符串
68
87
  */
69
88
  getString(): string;
70
89
  /**
71
- * Get the hashcode of current path
90
+ * IComparable implementation — returns 0 as the hash code for this path.
91
+ * IComparable 实现——返回 0 作为此路径的哈希码。
72
92
  *
73
- * @returns always return 0
93
+ * @returns always 0 / 始终返回 0
74
94
  */
75
95
  getHashCode(): number;
76
96
  }
@@ -1,23 +1,36 @@
1
1
  /**@format */
2
- /** Encrypt Option Type */
2
+ /**
3
+ * Encryption operation direction.
4
+ * 加密操作方向枚举。
5
+ */
3
6
  export declare enum EncryptOption {
7
+ /** Encryption direction — encode plaintext into ciphertext. / 加密方向——将明文编码为密文。 */
4
8
  Encryption = 0,
9
+ /** Decryption direction — decode ciphertext back to plaintext. / 解密方向——将密文还原为明文。 */
5
10
  Decryption = 1
6
11
  }
7
- /** An Interface of the Cipher */
12
+ /**
13
+ * Cipher algorithm interface.
14
+ * Any class that implements a symmetric encryption algorithm should implement this interface.
15
+ *
16
+ * 密码算法接口。
17
+ * 实现对称加密算法的类应实现此接口。
18
+ */
8
19
  export interface ICipher {
9
20
  /**
10
- * To encode the source value
21
+ * Encode the source byte array into an encrypted byte array.
22
+ * 将源字节数组编码为加密后的字节数组。
11
23
  *
12
- * @param source the source value
13
- * @returns return the encoded value
24
+ * @param source the plaintext source value as a number array / 明文源数据(数字数组形式)
25
+ * @returns the encrypted byte array / 加密后的字节数组
14
26
  */
15
27
  encryption(source: number[]): number[];
16
28
  /**
17
- * To decode the encoded value
29
+ * Decode the encrypted byte array back to the original plaintext byte array.
30
+ * 将加密字节数组解码还原为原始明文字节数组。
18
31
  *
19
- * @param source the encoded value
20
- * @returns return the decoded value
32
+ * @param source the encrypted value as a number array / 加密数据(数字数组形式)
33
+ * @returns the decrypted byte array / 解密后的字节数组
21
34
  */
22
35
  decryption(source: number[]): number[];
23
36
  }
@@ -1,80 +1,98 @@
1
1
  /**@format */
2
2
  import { IComparable } from "./Types";
3
3
  /**
4
- * Tianyu Map
5
- * Support Customized Object type
4
+ * Tianyu Map — a generic Map implementation that supports customized object types as keys.
5
+ * Keys must implement IComparable; the getString() value is used internally as the actual map key.
6
+ *
7
+ * Tianyu 映射表——支持自定义对象类型作为键的泛型 Map 实现。
8
+ * 键必须实现 IComparable 接口;内部使用 getString() 返回值作为实际映射键。
6
9
  */
7
10
  export declare class TMap<K extends IComparable, V> {
11
+ /** Internal value store keyed by the string form of K. / 以 K 的字符串形式为键的内部值存储。 */
8
12
  private _map;
13
+ /** Internal key object store for retrieving the original K instance. / 存储原始 K 实例的内部键对象映射。 */
9
14
  private _kMap;
10
15
  /**
11
- * Create an empty Tianyu Map Instance
16
+ * Create an empty TMap instance.
17
+ * 创建一个空的 TMap 实例。
12
18
  */
13
19
  constructor();
14
20
  /**
15
- * Clean the Map instance
21
+ * Remove all key-value pairs from the map.
22
+ * 清除映射表中的所有键值对。
16
23
  */
17
24
  clear(): void;
18
25
  /**
19
- * Delete a specified item from the instance
26
+ * Delete the element with the specified key from the map.
27
+ * 从映射表中删除指定键对应的元素。
20
28
  *
21
- * @param key The key of the item
22
- * @returns return true if deleted successful and return false if failed
29
+ * @param key the key of the element to delete / 要删除的元素的键
30
+ * @returns true if the element was found and deleted, false otherwise / 删除成功返回 true,否则返回 false
23
31
  */
24
32
  delete(key: K): boolean;
25
33
  /**
26
- * Executes a provided function once per each key/value pair in the Map, in insertion order.
34
+ * Execute a callback once for each key-value pair in insertion order.
35
+ * 按插入顺序对每个键值对执行一次回调函数。
27
36
  *
28
- * @param callbackfn provided execution function
29
- * @param thisArg additional args
37
+ * @param callbackfn the function to execute per entry / 每条记录执行的回调函数
38
+ * @param thisArg optional value to use as `this` in the callback / 回调中可选的 this 绑定值
30
39
  */
31
40
  forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, thisArg?: any): void;
32
41
  /**
33
- * Returns a specified element from the Map object. If the value that is associated to the provided key is an object,
34
- * then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.
42
+ * Return the value associated with the specified key.
43
+ * If the key is associated with an object, a reference to that object is returned
44
+ * any mutation will affect the stored value.
35
45
  *
36
- * @param key The key of the value
37
- * @returns Returns the element associated with the specified key.
38
- * If no element is associated with the specified key, undefined is returned.
46
+ * 返回与指定键关联的值。
47
+ * 若键对应的值为对象,则返回其引用——对该对象的修改会影响映射表中存储的值。
48
+ *
49
+ * @param key the key to look up / 要查找的键
50
+ * @returns the associated value, or undefined if not found / 关联的值,未找到时返回 undefined
39
51
  */
40
52
  get(key: K): V | undefined;
41
53
  /**
42
- * Get a boolean value indicates whether an element with the specified key exists or not.
54
+ * Check whether an element with the specified key exists in the map.
55
+ * 检查映射表中是否存在指定键对应的元素。
43
56
  *
44
- * @param key The key what wants to search
45
- * @returns return true if the value is found
57
+ * @param key the key to search for / 要查找的键
58
+ * @returns true if the key exists / 键存在时返回 true
46
59
  */
47
60
  has(key: K): boolean;
48
61
  /**
49
- * Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.
62
+ * Add or update the element with the specified key and value.
63
+ * 添加或更新具有指定键和值的元素。
50
64
  *
51
- * @param key The key of new element
52
- * @param value The value of new element
53
- * @returns return the instance that is current instance
65
+ * @param key the key of the new or existing element / 新增或已有元素的键
66
+ * @param value the value to associate with the key / 要与键关联的值
67
+ * @returns the current TMap instance (for chaining) / 当前 TMap 实例(支持链式调用)
54
68
  */
55
69
  set(key: K, value: V): this;
56
70
  /**
57
- * Get a number of elements in the Map
71
+ * Get the number of elements stored in the map.
72
+ * 获取映射表中存储的元素数量。
58
73
  *
59
- * @returns return the count of elements
74
+ * @returns the element count / 元素数量
60
75
  */
61
76
  size(): number;
62
77
  /**
63
- * Get all keys of the Map
78
+ * Return an iterator over all keys (as original K instances) in the map.
79
+ * 返回映射表中所有键(原始 K 实例)的迭代器。
64
80
  *
65
- * @returns return a keys iterator
81
+ * @returns a keys iterator / 键迭代器
66
82
  */
67
83
  keys(): IterableIterator<K>;
68
84
  /**
69
- * Get all values of the Map
85
+ * Return an iterator over all values in the map.
86
+ * 返回映射表中所有值的迭代器。
70
87
  *
71
- * @returns return a values iterator
88
+ * @returns a values iterator / 值迭代器
72
89
  */
73
90
  values(): IterableIterator<V>;
74
91
  /**
75
- * Get an Iterator of the Map
92
+ * Return an iterator that yields [K, V] tuple pairs in insertion order.
93
+ * 返回按插入顺序产出 [K, V] 元组对的迭代器。
76
94
  *
77
- * @returns return an iterator object
95
+ * @returns an iterator object / 迭代器对象
78
96
  */
79
97
  [Symbol.iterator](): Iterator<[K | undefined, V | undefined]>;
80
98
  }
@@ -1,25 +1,57 @@
1
1
  /**@format */
2
- /**A record object type of boolean */
2
+ /**
3
+ * A record object type with string keys and boolean values.
4
+ * 键为字符串、值为布尔类型的记录对象类型。
5
+ */
3
6
  export type MapOfBoolean = Record<string, boolean>;
4
- /**A record object type of string array */
7
+ /**
8
+ * A record object type with string keys and string array values.
9
+ * 键为字符串、值为字符串数组的记录对象类型。
10
+ */
5
11
  export type MapOfStrings = Record<string, string[]>;
6
- /**A record object type of string */
12
+ /**
13
+ * A record object type with string keys and string values.
14
+ * 键为字符串、值为字符串的记录对象类型。
15
+ */
7
16
  export type MapOfString = Record<string, string>;
8
- /**A record object type of customized */
17
+ /**
18
+ * A record object type with string keys and customized value type.
19
+ * 键为字符串、值为自定义类型的记录对象类型。
20
+ */
9
21
  export type MapOfType<T> = Record<string, T>;
10
- /** no parameter call back function */
22
+ /**
23
+ * A callback function type with no parameters and no return value.
24
+ * 无参数、无返回值的回调函数类型。
25
+ */
11
26
  export type CallbackAction = () => void;
12
- /** call back function with customized type parameter */
27
+ /**
28
+ * A callback function type with a single typed parameter and no return value.
29
+ * 带单个泛型参数、无返回值的回调函数类型。
30
+ */
13
31
  export type CallbackActionT<T> = (value: T) => void;
14
- /** A key value pair to include a key and a value */
32
+ /**
33
+ * A key-value pair interface that holds a key and its associated value.
34
+ * 包含键和对应值的键值对接口。
35
+ */
15
36
  export interface KeyValuePair<K, V> {
37
+ /** The key of the pair. / 键值对的键。 */
16
38
  key: K;
39
+ /** The value associated with the key. / 与键对应的值。 */
17
40
  value: V;
18
41
  }
19
- /** Tianyu Comparable Interface */
42
+ /**
43
+ * Tianyu Comparable Interface.
44
+ * Tianyu 可比较接口,要求实现对象标识字符串和哈希码方法。
45
+ */
20
46
  export interface IComparable {
21
- /** Get a string what can indicate the object unified */
47
+ /**
48
+ * Get a string that uniquely identifies the object instance.
49
+ * 获取能唯一标识当前对象实例的字符串。
50
+ */
22
51
  getString(): string;
23
- /** Get a number which is the hash value of the object instance */
52
+ /**
53
+ * Get the hash code number of the object instance.
54
+ * 获取当前对象实例的哈希码数值。
55
+ */
24
56
  getHashCode(): number;
25
57
  }