quai-types 0.1.0 → 0.1.1

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +10 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -25,13 +25,21 @@ export type QuaiResponse = {
25
25
  end(body?: string | Uint8Array): unknown;
26
26
  write(chunk: string | Uint8Array): unknown;
27
27
  };
28
+ /**
29
+ * What a handler may return.
30
+ *
31
+ * Anything, and it is ignored: writing `res.end(...)` as the last expression
32
+ * of an arrow function returns whatever end() gives back, and rejecting that
33
+ * would fail the most natural way to write a handler.
34
+ */
35
+ type HandlerResult = unknown;
28
36
  /**
29
37
  * A Node function.
30
38
  *
31
39
  * Quai supplies the server; the handler decides what a request produces. It
32
40
  * may be exported as `default` or as `handler`.
33
41
  */
34
- export type QuaiHandler = (request: QuaiRequest, response: QuaiResponse) => void | Promise<void>;
42
+ export type QuaiHandler = (request: QuaiRequest, response: QuaiResponse) => HandlerResult;
35
43
  /** A Bun function, written against the platform's fetch-style handler. */
36
44
  export type QuaiBunHandler = (request: Request) => Response | Promise<Response>;
37
45
  /** Identity at runtime; it is the type annotation that does the work. */
@@ -75,3 +83,4 @@ export type QuaiConfig = {
75
83
  };
76
84
  /** Identity at runtime; use it to get completion and checking on a manifest. */
77
85
  export declare function defineConfig(config: QuaiConfig): QuaiConfig;
86
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quai-types",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Types for Quai projects: handlers and quai.toml",
5
5
  "license": "MIT",
6
6
  "repository": {