fulmine.js 5.19.2 → 5.19.4

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/src/route.js CHANGED
@@ -25,9 +25,8 @@ const SYNC_LIMIT = 100;
25
25
  /**
26
26
  * The handlers registered for one path, and the walk over them.
27
27
  *
28
- * Express exports this, and code that builds a route by hand rather than through a router uses it:
29
- * `new Route(path)`, a handler per verb, then `dispatch(req, res, done)`. It does no matching, the
30
- * caller having decided the route is the right one; all it knows is which verb a handler answers.
28
+ * Express exports this, and code that builds a route by hand uses it: `new Route(path)`, a handler
29
+ * per verb, then `dispatch(req, res, done)`. It does no matching, only which verb a handler answers.
31
30
  */
32
31
  class Route {
33
32
  /**
@@ -69,9 +68,9 @@ class Route {
69
68
  /**
70
69
  * Runs the handlers this request's verb reaches, one after another through next().
71
70
  *
72
- * @param {any} req
73
- * @param {any} res
74
- * @param {(err?: any) => void} done called when the route is finished with the request, with
71
+ * @param {any} req a Request, or whatever a caller that built this Route by hand is serving
72
+ * @param {any} res the matching response
73
+ * @param {(err?: unknown) => void} done called when the route is finished with the request, with
75
74
  * whatever error it ended on
76
75
  */
77
76
  dispatch(req, res, done) {
@@ -114,7 +113,7 @@ class Route {
114
113
  return done(err);
115
114
  }
116
115
 
117
- const handle = /** @type {any} */ (layer).handle;
116
+ const handle = /** @type {{handle: Function}} */ (layer).handle;
118
117
  // an error only reaches the four-argument handlers, and everything else only runs
119
118
  // while there is no error, which is the same rule ordinary dispatch follows
120
119
  if (err) {
@@ -147,7 +146,7 @@ class Route {
147
146
  * Refuses a handler that could never be called, worded as express words it.
148
147
  *
149
148
  * @param {string} method the verb this was registered for, for the message
150
- * @param {any[]} handlers
149
+ * @param {unknown[]} handlers
151
150
  */
152
151
  function checkRouteHandlers(method, handlers) {
153
152
  for (const handle of handlers) {