diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 036e9f58ce..3ebcb9b395 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -6,11 +6,23 @@ // TypeScript Version: 2.6 /// +/// import * as http from "http"; import * as url from "url"; +import * as fetch from "isomorphic-unfetch"; declare namespace next { + interface NextContext { + pathname?: string; //path section of URL + query?: any; // meant to be an object - // query string section of URL parsed as an object + asPath?: string; // String of the actual path (including the query) shows in the browser + req?: http.IncomingMessage; //HTTP request object (server only) + res?: http.ServerResponse; //HTTP response object (server only) + jsonPageRes?: fetch.IsomorphicResponse; //Fetch Response object (client only) - from https://developer.mozilla.org/en-US/docs/Web/API/Response + err?: Error; //Error object if any error is encountered during the rendering + } + type UrlLike = url.UrlObject | url.Url; interface ServerConfig {