@agoric/internal 0.2.2-dev-93e8bb9.0 → 0.2.2-dev-adc0836.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/internal",
3
- "version": "0.2.2-dev-93e8bb9.0+93e8bb9",
3
+ "version": "0.2.2-dev-adc0836.0+adc0836",
4
4
  "description": "Externally unsupported utilities internal to agoric-sdk",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -37,5 +37,5 @@
37
37
  "publishConfig": {
38
38
  "access": "public"
39
39
  },
40
- "gitHead": "93e8bb99a4ca1955139810f08ab33f97a4d84614"
40
+ "gitHead": "adc0836e01eab0fd6084ecf3f59687668a98ed54"
41
41
  }
package/src/utils.d.ts CHANGED
@@ -5,17 +5,22 @@ export function throwLabeled(innerErr: Error, label: string | number, ErrorConst
5
5
  export function applyLabelingError<A, R>(func: (...args: A[]) => R, args: A[], label?: string | number | undefined): R;
6
6
  export function getMethodNames(val: any): (string | symbol)[];
7
7
  export function bindAllMethods(obj: Remotable): Remotable;
8
+ /**
9
+ * @template T
10
+ * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
11
+ * flatten the type output to improve type hints shown in editors
12
+ * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
13
+ */
14
+ /**
15
+ * @typedef {(...args: any[]) => any} Callable
16
+ */
8
17
  /**
9
18
  * @template {{}} T
10
- * @typedef {{ [K in keyof T]: DeeplyAwaited<T[K]> }} DeeplyAwaitedObject
19
+ * @typedef {{ [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]> }} DeeplyAwaitedObject
11
20
  */
12
21
  /**
13
- * Caveats:
14
- * - doesn't recur within Promise results
15
- * - resulting type has wrapper in its name
16
- *
17
22
  * @template T
18
- * @typedef {T extends PromiseLike<any> ? Awaited<T> : T extends {} ? DeeplyAwaitedObject<T> : Awaited<T>} DeeplyAwaited
23
+ * @typedef {T extends PromiseLike<any> ? Awaited<T> : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>} DeeplyAwaited
19
24
  */
20
25
  /**
21
26
  * A more constrained version of {deeplyFulfilled} for type safety until https://github.com/endojs/endo/issues/1257
@@ -41,12 +46,13 @@ export const forever: AsyncIterable<undefined>;
41
46
  export function whileTrue<T>(produce: () => T): AsyncIterable<Awaited<T>>;
42
47
  export function untilTrue<T>(produce: () => T): AsyncIterable<Awaited<T>>;
43
48
  export type Remotable = import('@endo/marshal/src/types').Remotable;
44
- export type DeeplyAwaitedObject<T extends {}> = { [K in keyof T]: DeeplyAwaited<T[K]>; };
45
49
  /**
46
- * Caveats:
47
- * - doesn't recur within Promise results
48
- * - resulting type has wrapper in its name
50
+ * flatten the type output to improve type hints shown in editors
51
+ * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
49
52
  */
50
- export type DeeplyAwaited<T> = T extends PromiseLike<any> ? Awaited<T> : T extends {} ? DeeplyAwaitedObject<T> : Awaited<T>;
53
+ export type Simplify<T> = { [KeyType_1 in keyof T]: T[KeyType_1]; };
54
+ export type Callable = (...args: any[]) => any;
55
+ export type DeeplyAwaitedObject<T extends {}> = { [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]>; };
56
+ export type DeeplyAwaited<T> = T extends PromiseLike<any> ? Awaited<T> : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>;
51
57
  export type AllDefined<T extends Record<string, unknown>> = { [P in keyof T]: Exclude<T[P], undefined>; };
52
58
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.js"],"names":[],"mappings":"AA4BO,0EAcN;AA0CM,gJAIN;AAQM,0CAHI,MAAM,MAAM,GAAG,MAAM,CAAC,cACtB,MAAM,MAAM,GAAG,MAAM,CAAC,uBAKhC;AASM,uCALI,KAAK,SACL,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KG,CAAC,mFAFoB,OAAO,KAAK,QAAQ,IAAI,CAAC,gBAY7C;AAiBG,0GAUN;AAQD,+CAAoD;AAU7C,0EAUH;AAUG,0EAaH;wBA3aU,OAAO,yBAAyB,EAAE,SAAS;;;;;;iCA4PlC,GAAG,EAAE,KAAK,GAAG;;+BAUvB,CAAC,SAAS,YAAY,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,SAAS,EAAE,GAAG,SAAS,oBAAoB,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC"}
package/src/utils.js CHANGED
@@ -248,18 +248,25 @@ export const bindAllMethods = obj =>
248
248
  );
249
249
  harden(bindAllMethods);
250
250
 
251
+ /**
252
+ * @template T
253
+ * @typedef {{[KeyType in keyof T]: T[KeyType]} & {}} Simplify
254
+ * flatten the type output to improve type hints shown in editors
255
+ * https://github.com/sindresorhus/type-fest/blob/main/source/simplify.d.ts
256
+ */
257
+
258
+ /**
259
+ * @typedef {(...args: any[]) => any} Callable
260
+ */
261
+
251
262
  /**
252
263
  * @template {{}} T
253
- * @typedef {{ [K in keyof T]: DeeplyAwaited<T[K]> }} DeeplyAwaitedObject
264
+ * @typedef {{ [K in keyof T]: T[K] extends Callable ? T[K] : DeeplyAwaited<T[K]> }} DeeplyAwaitedObject
254
265
  */
255
266
 
256
267
  /**
257
- * Caveats:
258
- * - doesn't recur within Promise results
259
- * - resulting type has wrapper in its name
260
- *
261
268
  * @template T
262
- * @typedef {T extends PromiseLike<any> ? Awaited<T> : T extends {} ? DeeplyAwaitedObject<T> : Awaited<T>} DeeplyAwaited
269
+ * @typedef {T extends PromiseLike<any> ? Awaited<T> : T extends {} ? Simplify<DeeplyAwaitedObject<T>> : Awaited<T>} DeeplyAwaited
263
270
  */
264
271
 
265
272
  /**