@cloudcome/utils-core 1.10.0 → 1.11.0

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.
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const VERSION = "1.9.2";
3
+ const VERSION = "1.10.0";
4
4
  exports.VERSION = VERSION;
5
5
  //# sourceMappingURL=index.cjs.map
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const VERSION = "1.9.2";
1
+ const VERSION = "1.10.0";
2
2
  export {
3
3
  VERSION
4
4
  };
package/dist/types.d.ts CHANGED
@@ -139,4 +139,17 @@ export type IsOnlyProperty<T, P> = keyof T extends P ? true : false;
139
139
  * ```
140
140
  */
141
141
  export type HasProperty<T, K> = K extends keyof T ? true : false;
142
+ /**
143
+ * 精确匹配类型
144
+ * @description 检查类型 T 是否精确匹配给定的形状 Shape。如果 T 包含 Shape 中不存在的额外属性,则不匹配。
145
+ * @template T - 要检查的类型
146
+ * @template Shape - 期望的形状/结构
147
+ * @example
148
+ * ```typescript
149
+ * type Result1 = Exact<{ a: 1 }, { a: 1 }>; // { a: 1 }
150
+ * type Result2 = Exact<{ a: 1; b: 2 }, { a: 1 }>; // never
151
+ * type Result3 = Exact<{ a: 1 }, { a: 1; b: 2 }>; // never
152
+ * ```
153
+ */
154
+ export type Exact<T, Shape> = T extends Shape ? (Exclude<keyof T, keyof Shape> extends never ? T : never) : never;
142
155
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcome/utils-core",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "cloudcome core utils",
5
5
  "engines": {
6
6
  "node": ">=22"