forked from fastify/fastify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.d.ts
44 lines (37 loc) · 1.44 KB
/
utils.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import * as http from 'http'
import * as http2 from 'http2'
import * as https from 'https'
/**
* Standard HTTP method strings
*/
export type HTTPMethods = 'DELETE' | 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'OPTIONS'
/**
* A union type of the Node.js server types from the http, https, and http2 modules.
*/
export type RawServerBase = http.Server | https.Server | http2.Http2Server | http2.Http2SecureServer
/**
* The default server type
*/
export type RawServerDefault = http.Server
/**
* The default request type based on the server type. Utilizes generic constraining.
*/
export type RawRequestDefaultExpression<
RawServer extends RawServerBase = RawServerDefault
> = RawServer extends http.Server | https.Server ? http.IncomingMessage
: RawServer extends http2.Http2Server | http2.Http2SecureServer ? http2.Http2ServerRequest
: never
/**
* The default reply type based on the server type. Utilizes generic constraining.
*/
export type RawReplyDefaultExpression<
RawServer extends RawServerBase = RawServerDefault
> = RawServer extends http.Server | https.Server ? http.ServerResponse
: RawServer extends http2.Http2Server | http2.Http2SecureServer ? http2.Http2ServerResponse
: never
export type RequestBodyDefault = unknown
export type RequestQuerystringDefault = unknown
export type RequestParamsDefault = unknown
export type RequestHeadersDefault = unknown
export type ContextConfigDefault = unknown
export type ReplyDefault = unknown