Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing type aliases #22

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export {
HTTPError as errors
}

export const STATUS_CODES: typeof constants.status

export interface HTTPIncomingMessageEvents extends ReadableEvents {
timeout: []
}
Expand Down Expand Up @@ -65,6 +67,8 @@ export class HTTPIncomingMessage {
)
}

export { HTTPIncomingMessage as IncomingMessage }

export interface HTTPOutgoingMessageEvents extends WritableEvents {
timeout: []
}
Expand All @@ -90,6 +94,8 @@ export class HTTPOutgoingMessage {
constructor(socket?: TCPSocket)
}

export { HTTPOutgoingMessage as OutgoingMessage }

export interface HTTPAgentOptions {
keepAlive?: boolean
keepAliveMsecs?: number
Expand Down Expand Up @@ -122,6 +128,8 @@ export class HTTPAgent {

export const globalAgent: HTTPAgent

export { HTTPAgent as Agent }

export interface HTTPServerEvents extends TCPServerEvents {
request: [req: HTTPIncomingMessage, res: HTTPServerResponse]
upgrade: [req: HTTPIncomingMessage, socket: TCPSocket, head: Buffer]
Expand All @@ -146,6 +154,8 @@ export class HTTPServer {
)
}

export { HTTPServer as Server }

export interface HTTPServerResponse extends HTTPOutgoingMessage {
readonly req: HTTPIncomingMessage
readonly statusCode: HTTPStatusCode
Expand All @@ -167,6 +177,8 @@ export class HTTPServerResponse {
constructor(socket: TCPSocket, req: HTTPIncomingMessage, close: boolean)
}

export { HTTPServerResponse as ServerResponse }

export interface HTTPServerConnectionOptions {
IncomingMessage?: typeof HTTPIncomingMessage
ServerResponse?: typeof HTTPServerResponse
Expand All @@ -192,6 +204,8 @@ export class HTTPServerConnection {
static for(socket: TCPSocket): HTTPServerConnection
}

export { HTTPServerConnection as ServerConnection }

export interface HTTPClientRequestEvents extends HTTPOutgoingMessageEvents {
response: [res: HTTPIncomingMessage]
upgrade: [res: HTTPIncomingMessage, socket: TCPSocket, head: Buffer]
Expand All @@ -218,6 +232,8 @@ export class HTTPClientRequest {
constructor(onresponse: () => void)
}

export { HTTPClientRequest as ClientRequest }

export interface HTTPClientConnectionOptions {
IncomingMessage?: typeof HTTPIncomingMessage
}
Expand All @@ -242,6 +258,8 @@ export class HTTPClientConnection {
): HTTPClientConnection
}

export { HTTPClientConnection as ClientConnection }

export function createServer(
opts?: HTTPServerConnectionOptions,
onrequest?: (req: HTTPIncomingMessage, res: HTTPServerResponse) => void
Expand Down