ecspresso 0.6.0 → 0.7.1

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.
@@ -7,17 +7,20 @@
7
7
  */
8
8
  type ExactlyCompatible<T, U> = T extends U ? U extends T ? true : false : false;
9
9
  /**
10
- * Check if two record types are compatible (no conflicting keys)
10
+ * Check if two record types are compatible (no conflicting keys).
11
+ * Returns true if no overlapping keys or all overlapping keys have exactly the same type.
11
12
  */
12
- export type TypesAreCompatible<T extends Record<string, any>, U extends Record<string, any>> = {
13
+ export type TypesAreCompatible<T extends Record<string, any>, U extends Record<string, any>> = [
14
+ keyof T & keyof U
15
+ ] extends [never] ? true : {
13
16
  [K in keyof T & keyof U]: ExactlyCompatible<T[K], U[K]>;
14
17
  }[keyof T & keyof U] extends false ? false : true;
15
18
  /**
16
- * Simplified bundle compatibility checker
17
- * Returns true if bundles can be merged without type conflicts
18
- * More lenient - allows bundles without shared keys to be merged
19
+ * Bundle compatibility checker.
20
+ * Returns true if bundles can be merged without type conflicts.
21
+ * All overlapping keys across all type categories must have identical types.
19
22
  */
20
- export type BundlesAreCompatible<C1 extends Record<string, any>, C2 extends Record<string, any>, E1 extends Record<string, any>, E2 extends Record<string, any>, R1 extends Record<string, any>, R2 extends Record<string, any>> = keyof C1 & keyof C2 extends never ? keyof E1 & keyof E2 extends never ? keyof R1 & keyof R2 extends never ? true : TypesAreCompatible<R1, R2> : TypesAreCompatible<E1, E2> : TypesAreCompatible<C1, C2>;
23
+ export type BundlesAreCompatible<C1 extends Record<string, any>, C2 extends Record<string, any>, E1 extends Record<string, any>, E2 extends Record<string, any>, R1 extends Record<string, any>, R2 extends Record<string, any>, A1 extends Record<string, unknown> = {}, A2 extends Record<string, unknown> = {}, S1 extends Record<string, any> = {}, S2 extends Record<string, any> = {}> = TypesAreCompatible<C1, C2> extends true ? TypesAreCompatible<E1, E2> extends true ? TypesAreCompatible<R1, R2> extends true ? TypesAreCompatible<A1, A2> extends true ? TypesAreCompatible<S1, S2> : false : false : false : false;
21
24
  /**
22
25
  * Utility type for merging two types
23
26
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecspresso",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",