[next] added QueryStringMapObect type

This commit is contained in:
Resi Respati
2018-06-26 20:46:13 +07:00
parent 4663cef676
commit 9ceaab4ba5
+10 -45
View File
@@ -16,6 +16,11 @@ import * as url from "url";
import { Response as NodeResponse } from "node-fetch";
declare namespace next {
/** Map object used in query strings. */
export interface QueryStringMapObject {
[key: string]: string | string[] | undefined;
}
/**
* Context object used in methods like `getInitialProps()`
* <<https://github.com/zeit/next.js/issues/1651>>
@@ -24,15 +29,7 @@ declare namespace next {
/** path section of URL */
pathname: string;
/** query string section of URL parsed as an object */
query: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
};
query: QueryStringMapObject;
/** String of the actual path (including the query) shows in the browser */
asPath: string;
/** HTTP request object (server only) */
@@ -101,15 +98,7 @@ declare namespace next {
req: http.IncomingMessage,
res: http.ServerResponse,
pathname: string,
query?: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
},
query?: QueryStringMapObject,
parsedUrl?: UrlLike
): Promise<void>;
renderError(
@@ -117,15 +106,7 @@ declare namespace next {
req: http.IncomingMessage,
res: http.ServerResponse,
pathname: string,
query?: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
}
query?: QueryStringMapObject
): Promise<void>;
render404(
req: http.IncomingMessage,
@@ -136,30 +117,14 @@ declare namespace next {
req: http.IncomingMessage,
res: http.ServerResponse,
pathname: string,
query?: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
}
query?: QueryStringMapObject
): Promise<string>;
renderErrorToHTML(
err: any,
req: http.IncomingMessage,
res: http.ServerResponse,
pathname: string,
query?: {
[key: string]:
| boolean
| boolean[]
| number
| number[]
| string
| string[];
}
query?: QueryStringMapObject
): Promise<string>;
serveStatic(