Skip to content

Commit

Permalink
docs(store): better MethodGuardMaker example
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Mar 17, 2023
1 parent 3d65d2b commit ba481f6
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/store/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,17 @@

/**
* @typedef {any} MethodGuardMaker
* a parameter list like foo(a, b, c = d, …e) => f should be guarded by
* something like
* foo: M.call(AShape, BShape).optional(CShape).rest(EShape).returns(FShape)
* optional is for optional (=) params. rest is for … (varargs) params
* A method name and parameter/return signature like:
* ```js
* foo(a, b, c = d, ...e) => f
* ```
* should be guarded by something like:
* ```js
* {
* ...otherMethodGuards,
* foo: M.call(AShape, BShape).optional(CShape).rest(EShape).returns(FShape),
* }
* ```
*/

/** @typedef {{ klass: 'methodGuard', callKind: 'sync' | 'async', returnGuard: unknown }} MethodGuard */
Expand Down

0 comments on commit ba481f6

Please sign in to comment.