@endo/promise-kit 1.1.3 → 1.1.5

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/index.d.ts CHANGED
@@ -14,11 +14,11 @@ export function makePromiseKit<T>(): import("./src/types.js").PromiseKit<T>;
14
14
  * Unlike `Promise.race` it cleans up after itself so a non-resolved value doesn't hold onto
15
15
  * the result promise.
16
16
  *
17
- * @template T
18
- * @param {Iterable<T>} values An iterable of Promises.
19
- * @returns {Promise<Awaited<T>>} A new Promise.
17
+ * @template {readonly unknown[] | []} T
18
+ * @param {T} values An iterable of Promises.
19
+ * @returns {Promise<Awaited<T[number]>>} A new Promise.
20
20
  */
21
- export function racePromises<T>(values: Iterable<T>): Promise<Awaited<T>>;
21
+ export function racePromises<T extends readonly unknown[] | []>(values: T): Promise<Awaited<T[number]>>;
22
22
  export * from "./src/is-promise.js";
23
23
  export * from "./src/types.js";
24
24
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -40,9 +40,9 @@ harden(makePromiseKit);
40
40
  * Unlike `Promise.race` it cleans up after itself so a non-resolved value doesn't hold onto
41
41
  * the result promise.
42
42
  *
43
- * @template T
44
- * @param {Iterable<T>} values An iterable of Promises.
45
- * @returns {Promise<Awaited<T>>} A new Promise.
43
+ * @template {readonly unknown[] | []} T
44
+ * @param {T} values An iterable of Promises.
45
+ * @returns {Promise<Awaited<T[number]>>} A new Promise.
46
46
  */
47
47
  export function racePromises(values) {
48
48
  return harden(memoRace.call(BestPipelinablePromise, values));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endo/promise-kit",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "description": "Helper for making promises",
5
5
  "keywords": [
6
6
  "promise"
@@ -38,7 +38,7 @@
38
38
  "test:xs": "exit 0"
39
39
  },
40
40
  "dependencies": {
41
- "ses": "^1.6.0"
41
+ "ses": "^1.8.0"
42
42
  },
43
43
  "devDependencies": {
44
44
  "ava": "^6.1.3",
@@ -50,7 +50,7 @@
50
50
  "eslint-plugin-eslint-comments": "^3.2.0",
51
51
  "eslint-plugin-import": "^2.29.1",
52
52
  "prettier": "^3.2.5",
53
- "typescript": "5.5.2"
53
+ "typescript": "~5.6.1-rc"
54
54
  },
55
55
  "files": [
56
56
  "LICENSE*",
@@ -80,5 +80,5 @@
80
80
  "typeCoverage": {
81
81
  "atLeast": 90.9
82
82
  },
83
- "gitHead": "681b813ccb1fa177905dabf2ed3f5f248cb33ce7"
83
+ "gitHead": "cb060b7e22c92cc951fb03d86cdbceeae82fec34"
84
84
  }
@@ -17,11 +17,11 @@ export type PromiseMemoRecord = never | {
17
17
  * Unlike `Promise.race` it cleans up after itself so a non-resolved value doesn't hold onto
18
18
  * the result promise.
19
19
  *
20
- * @template T
20
+ * @template {readonly unknown[] | []} T
21
21
  * @template {PromiseConstructor} [P=PromiseConstructor]
22
22
  * @this {P}
23
- * @param {Iterable<T>} values An iterable of Promises.
24
- * @returns {Promise<Awaited<T>>} A new Promise.
23
+ * @param {T} values An iterable of Promises.
24
+ * @returns {Promise<Awaited<T[number]>>} A new Promise.
25
25
  */
26
- declare function race<T, P extends PromiseConstructor = PromiseConstructor>(this: P, values: Iterable<T>): Promise<Awaited<T>>;
26
+ declare function race<T extends readonly unknown[] | [], P extends PromiseConstructor = PromiseConstructor>(this: P, values: T): Promise<Awaited<T[number]>>;
27
27
  //# sourceMappingURL=memo-race.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memo-race.d.ts","sourceRoot":"","sources":["memo-race.js"],"names":[],"mappings":";qBAiCc,CAAC;aAED,CAAC,KAAK,CAAC,EAAE,OAAO,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,KAAM,IAAI;YAC/C,CAAC,GAAG,CAAC,EAAE,GAAG,KAAM,IAAI;;gCAIpB,KAAK,GACb;IAAC,OAAO,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAC,GAC1C;IAAC,OAAO,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAC;AAgE1C;;;;;;;;;;;;GAYG;AACH,sBANa,CAAC,EACqB,CAAC,SAAtB,kBAAmB,wCAEtB,QAAQ,CAAC,CAAC,CAAC,GACT,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAgC/B"}
1
+ {"version":3,"file":"memo-race.d.ts","sourceRoot":"","sources":["memo-race.js"],"names":[],"mappings":";qBAiCc,CAAC;aAED,CAAC,KAAK,CAAC,EAAE,OAAO,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC,KAAM,IAAI;YAC/C,CAAC,GAAG,CAAC,EAAE,GAAG,KAAM,IAAI;;gCAIpB,KAAK,GACb;IAAC,OAAO,EAAE,KAAK,CAAC;IAAC,SAAS,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAA;CAAC,GAC1C;IAAC,OAAO,EAAE,IAAI,CAAC;IAAC,SAAS,CAAC,EAAE,SAAS,CAAA;CAAC;AAgE1C;;;;;;;;;;;;GAYG;AACH,sBANuC,CAAC,SAA1B,SAAS,OAAO,EAAE,GAAG,EAAG,EACH,CAAC,SAAtB,kBAAmB,wCAEtB,CAAC,GACC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAiCvC"}
package/src/memo-race.js CHANGED
@@ -111,15 +111,16 @@ const { race } = {
111
111
  * Unlike `Promise.race` it cleans up after itself so a non-resolved value doesn't hold onto
112
112
  * the result promise.
113
113
  *
114
- * @template T
114
+ * @template {readonly unknown[] | []} T
115
115
  * @template {PromiseConstructor} [P=PromiseConstructor]
116
116
  * @this {P}
117
- * @param {Iterable<T>} values An iterable of Promises.
118
- * @returns {Promise<Awaited<T>>} A new Promise.
117
+ * @param {T} values An iterable of Promises.
118
+ * @returns {Promise<Awaited<T[number]>>} A new Promise.
119
119
  */
120
120
  race(values) {
121
121
  let deferred;
122
- /** @type {T[]} */
122
+ /** @type {[...T]} */
123
+ // @ts-expect-error filled by the loop
123
124
  const cachedValues = [];
124
125
  const C = this;
125
126
  const result = new C((resolve, reject) => {