@cashscript/utils 0.13.0-next.0 → 0.13.0-next.2

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/types.d.ts CHANGED
@@ -28,7 +28,6 @@ export declare enum PrimitiveType {
28
28
  }
29
29
  export declare function explicitlyCastable(from?: Type, to?: Type): boolean;
30
30
  export declare function implicitlyCastable(actual?: Type, expected?: Type): boolean;
31
- export declare function resultingType(left?: Type, right?: Type): Type | undefined;
32
31
  export declare function arrayType(types: Type[]): Type | undefined;
33
32
  export declare function implicitlyCastableSignature(actual: Type[], expected: Type[]): boolean;
34
33
  export declare function parseType(str: string): Type;
package/dist/types.js CHANGED
@@ -146,7 +146,9 @@ export function implicitlyCastable(actual, expected) {
146
146
  // Other primitive types can only be implicitly cast to themselves
147
147
  return actual === expected;
148
148
  }
149
- export function resultingType(left, right) {
149
+ function resultingTypeForArrayElements(left, right) {
150
+ if (!left || !right)
151
+ return undefined;
150
152
  if (implicitlyCastable(left, right))
151
153
  return right;
152
154
  if (implicitlyCastable(right, left))
@@ -161,7 +163,7 @@ export function arrayType(types) {
161
163
  return undefined;
162
164
  let resType = types[0];
163
165
  types.forEach((t) => {
164
- resType = resultingType(resType, t);
166
+ resType = resultingTypeForArrayElements(resType, t);
165
167
  });
166
168
  return resType;
167
169
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cashscript/utils",
3
- "version": "0.13.0-next.0",
3
+ "version": "0.13.0-next.2",
4
4
  "description": "CashScript utilities and types",
5
5
  "keywords": [
6
6
  "bitcoin cash",
@@ -32,25 +32,21 @@
32
32
  },
33
33
  "scripts": {
34
34
  "build": "yarn clean && yarn compile",
35
- "build:test": "yarn clean:test && yarn compile:test",
36
35
  "clean": "rm -rf ./dist",
37
- "clean:test": "rm -rf ./dist-test",
38
36
  "compile": "tsc -p tsconfig.build.json",
39
- "compile:test": "tsc -p tsconfig.test.json",
40
37
  "lint": "eslint . --ext .ts --ignore-path ../../.eslintignore",
41
38
  "prepare": "yarn build",
42
39
  "prepublishOnly": "yarn test && yarn lint",
43
- "pretest": "yarn build:test",
44
- "test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
40
+ "test": "vitest run"
45
41
  },
46
42
  "dependencies": {
47
43
  "@bitauth/libauth": "^3.1.0-next.8"
48
44
  },
49
45
  "devDependencies": {
50
- "@jest/globals": "^29.7.0",
46
+ "@vitest/coverage-v8": "^4.0.15",
51
47
  "eslint": "^8.54.0",
52
- "jest": "^29.7.0",
53
- "typescript": "^5.9.2"
48
+ "typescript": "^5.9.2",
49
+ "vitest": "^4.0.15"
54
50
  },
55
- "gitHead": "1514d30e3d5de5bb2024d6198ed93a7ae8ae4e30"
51
+ "gitHead": "817391f108ce46c826dbab6f11ee4f1bb269c27f"
56
52
  }