Add http2 types for "callback"

Currently is typed against IncomingMessage / ServerResponse, changing to be a union type including the new Http2ServerRequest & Http2ServerResponse
This commit is contained in:
Elwyn
2018-03-31 16:01:09 +13:00
committed by GitHub
parent def3d5d177
commit 3cd68af4a0

View File

@@ -21,6 +21,7 @@ import * as accepts from "accepts";
import * as Cookies from "cookies";
import { EventEmitter } from "events";
import { IncomingMessage, ServerResponse, Server } from "http";
import { Http2ServerRequest, Http2ServerResponse } from 'http2';
import httpAssert = require("http-assert");
import * as Keygrip from "keygrip";
import * as compose from "koa-compose";
@@ -500,9 +501,9 @@ declare class Application extends EventEmitter {
/**
* Return a request handler callback
* for node's native http server.
* for node's native http/http2 server.
*/
callback(): (req: IncomingMessage, res: ServerResponse) => void;
callback(): (req: IncomingMessage | Http2ServerRequest, res: ServerResponse | Http2ServerResponse) => void;
/**
* Initialize a new context.