Skip to content

Commit fda2b25

Browse files
authored
fix(exo): Correct the typing for makeExo methods (#2938)
2 parents ab70fd6 + 4c254ba commit fda2b25

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

packages/exo/src/exo-makers.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const makeSelf = (proto, instanceCount) => {
3232
return harden(self);
3333
};
3434

35+
/** @type {Record<PropertyKey, never>} */
3536
const emptyRecord = harden({});
3637

3738
/**
@@ -40,8 +41,6 @@ const emptyRecord = harden({});
4041
* state record of the (virtual/durable) instances of the kind/exoClass
4142
* should be empty, and that the returned maker function should have zero
4243
* parameters.
43-
*
44-
* @returns {{}}
4544
*/
4645
export const initEmpty = () => emptyRecord;
4746

@@ -218,14 +217,16 @@ export const defineExoClassKit = (
218217
harden(defineExoClassKit);
219218

220219
/**
221-
* @template {Methods} T
220+
* Return a singleton instance of an internal ExoClass with no state fields.
221+
*
222+
* @template {Methods} M
222223
* @param {string} tag
223224
* @param {import('@endo/patterns').InterfaceGuard<{
224-
* [M in keyof T]: import('@endo/patterns').MethodGuard
225+
* [K in keyof M]: import('@endo/patterns').MethodGuard
225226
* }> | undefined} interfaceGuard CAVEAT: static typing does not yet support `callWhen` transformation
226-
* @param {T} methods
227-
* @param {FarClassOptions<import('./types.js').ClassContext<{},T>>} [options]
228-
* @returns {Guarded<T>}
227+
* @param {ExoClassMethods<M, typeof initEmpty>} methods
228+
* @param {FarClassOptions<import('./types.js').ClassContext<{}, M>>} [options]
229+
* @returns {Guarded<M>}
229230
*/
230231
export const makeExo = (tag, interfaceGuard, methods, options = undefined) => {
231232
const makeInstance = defineExoClass(

0 commit comments

Comments
 (0)