@types/next
Advanced tools
Comparing version 2.4.6 to 2.4.7
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import * as React from "react"; | ||
@@ -3,0 +3,0 @@ export interface DocumentProps { |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import * as React from "react"; | ||
@@ -6,8 +6,18 @@ export interface DynamicOptions<TCProps, TLProps> { | ||
ssr?: boolean; | ||
modules?(props: TCProps & TLProps): { [key: string]: Promise<React.ComponentType<any>> }; | ||
render?(props: TCProps & TLProps, modules: { [key: string]: React.ComponentType<any> }): void; | ||
modules?( | ||
props: TCProps & TLProps, | ||
): { [key: string]: Promise<React.ComponentType<any>> }; | ||
render?( | ||
props: TCProps & TLProps, | ||
modules: { [key: string]: React.ComponentType<any> }, | ||
): void; | ||
} | ||
export class SameLoopPromise<T> extends Promise<T> { | ||
constructor(executor: (resolve: (value?: T) => void, reject: (reason?: any) => void) => void); | ||
constructor( | ||
executor: ( | ||
resolve: (value?: T) => void, | ||
reject: (reason?: any) => void, | ||
) => void, | ||
); | ||
setResult(value: T): void; | ||
@@ -17,2 +27,5 @@ setError(value: any): void; | ||
} | ||
export default function<TCProps, TLProps>(componentPromise: Promise<React.ComponentType<TCProps>>, options?: DynamicOptions<TCProps, TLProps>): React.ComponentType<TCProps & TLProps>; | ||
export default function<TCProps, TLProps>( | ||
componentPromise: Promise<React.ComponentType<TCProps>>, | ||
options?: DynamicOptions<TCProps, TLProps>, | ||
): React.ComponentType<TCProps & TLProps>; |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
export default class extends React.Component<{statusCode: number}> {} | ||
import * as React from "react"; | ||
export default class extends React.Component<{ statusCode: number }> {} |
@@ -1,2 +0,2 @@ | ||
import * as React from 'react'; | ||
import * as React from "react"; | ||
@@ -3,0 +3,0 @@ export function defaultHead(): JSX.Element[]; |
// Type definitions for next 2.4 | ||
// Project: https://github.com/zeit/next.js | ||
// Definitions by: Drew Hays <https://github.com/dru89> | ||
// Brice BERNARD <https://github.com/brikou> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -9,54 +10,137 @@ // TypeScript Version: 2.3 | ||
import * as http from 'http'; | ||
import * as url from 'url'; | ||
import * as http from "http"; | ||
import * as url from "url"; | ||
declare namespace next { | ||
type UrlLike = url.UrlObject | url.Url; | ||
type UrlLike = url.UrlObject | url.Url; | ||
interface ServerConfig { | ||
// known keys | ||
webpack?: any; | ||
webpackDevMiddleware?: any; | ||
poweredByHeader?: boolean; | ||
distDir?: string; | ||
assetPrefix?: string; | ||
configOrigin?: string; | ||
useFileSystemPublicRoutes?: boolean; | ||
interface ServerConfig { | ||
// known keys | ||
webpack?: any; | ||
webpackDevMiddleware?: any; | ||
poweredByHeader?: boolean; | ||
distDir?: string; | ||
assetPrefix?: string; | ||
configOrigin?: string; | ||
useFileSystemPublicRoutes?: boolean; | ||
// and since this is a config, it can take anything else, too. | ||
[key: string]: any; | ||
} | ||
// and since this is a config, it can take anything else, too. | ||
[key: string]: any; | ||
} | ||
interface ServerOptions { | ||
dir?: string; | ||
dev?: boolean; | ||
staticMarkup?: boolean; | ||
quiet?: boolean; | ||
conf?: ServerConfig; | ||
} | ||
interface ServerOptions { | ||
dir?: string; | ||
dev?: boolean; | ||
staticMarkup?: boolean; | ||
quiet?: boolean; | ||
conf?: ServerConfig; | ||
} | ||
interface Server { | ||
handleRequest(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl?: UrlLike): Promise<void>; | ||
getRequestHandler(): (req: http.IncomingMessage, res: http.ServerResponse, parsedUrl?: UrlLike) => Promise<void>; | ||
prepare(): Promise<void>; | ||
close(): Promise<void>; | ||
defineRoutes(): Promise<void>; | ||
start(): Promise<void>; | ||
run(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise<void>; | ||
interface Server { | ||
handleRequest( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
parsedUrl?: UrlLike, | ||
): Promise<void>; | ||
getRequestHandler(): ( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
parsedUrl?: UrlLike, | ||
) => Promise<void>; | ||
prepare(): Promise<void>; | ||
close(): Promise<void>; | ||
defineRoutes(): Promise<void>; | ||
start(): Promise<void>; | ||
run( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
parsedUrl: UrlLike, | ||
): Promise<void>; | ||
render(req: http.IncomingMessage, res: http.ServerResponse, pathname: string, query?: {[key: string]: any}, parsedUrl?: UrlLike): Promise<void>; | ||
renderError(err: any, req: http.IncomingMessage, res: http.ServerResponse, pathname: string, query?: {[key: string]: any}): Promise<void>; | ||
render404(req: http.IncomingMessage, res: http.ServerResponse, parsedUrl: UrlLike): Promise<void>; | ||
renderToHTML(req: http.IncomingMessage, res: http.ServerResponse, pathname: string, query?: {[key: string]: any}): Promise<string>; | ||
renderErrorToHTML(err: any, req: http.IncomingMessage, res: http.ServerResponse, pathname: string, query?: {[key: string]: any}): Promise<string>; | ||
render( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
pathname: string, | ||
query?: { | ||
[key: string]: | ||
| boolean | ||
| boolean[] | ||
| number | ||
| number[] | ||
| string | ||
| string[]; | ||
}, | ||
parsedUrl?: UrlLike, | ||
): Promise<void>; | ||
renderError( | ||
err: any, | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
pathname: string, | ||
query?: { | ||
[key: string]: | ||
| boolean | ||
| boolean[] | ||
| number | ||
| number[] | ||
| string | ||
| string[]; | ||
}, | ||
): Promise<void>; | ||
render404( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
parsedUrl: UrlLike, | ||
): Promise<void>; | ||
renderToHTML( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
pathname: string, | ||
query?: { | ||
[key: string]: | ||
| boolean | ||
| boolean[] | ||
| number | ||
| number[] | ||
| string | ||
| string[]; | ||
}, | ||
): Promise<string>; | ||
renderErrorToHTML( | ||
err: any, | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
pathname: string, | ||
query?: { | ||
[key: string]: | ||
| boolean | ||
| boolean[] | ||
| number | ||
| number[] | ||
| string | ||
| string[]; | ||
}, | ||
): Promise<string>; | ||
serveStatic(req: http.IncomingMessage, res: http.ServerResponse, path: string): Promise<void>; | ||
isServeableUrl(path: string): boolean; | ||
isInternalUrl(req: http.IncomingMessage): boolean; | ||
readBuildId(): string; | ||
handleBuildId(buildId: string, res: http.ServerResponse): boolean; | ||
getCompilationError(page: string, req: http.IncomingMessage, res: http.ServerResponse): Promise<any>; | ||
handleBuildHash(filename: string, hash: string, res: http.ServerResponse): void; | ||
send404(res: http.ServerResponse): void; | ||
} | ||
serveStatic( | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
path: string, | ||
): Promise<void>; | ||
isServeableUrl(path: string): boolean; | ||
isInternalUrl(req: http.IncomingMessage): boolean; | ||
readBuildId(): string; | ||
handleBuildId(buildId: string, res: http.ServerResponse): boolean; | ||
getCompilationError( | ||
page: string, | ||
req: http.IncomingMessage, | ||
res: http.ServerResponse, | ||
): Promise<any>; | ||
handleBuildHash( | ||
filename: string, | ||
hash: string, | ||
res: http.ServerResponse, | ||
): void; | ||
send404(res: http.ServerResponse): void; | ||
} | ||
} | ||
@@ -63,0 +147,0 @@ |
@@ -1,3 +0,3 @@ | ||
import * as url from 'url'; | ||
import * as React from 'react'; | ||
import * as url from "url"; | ||
import * as React from "react"; | ||
@@ -4,0 +4,0 @@ export type UrlLike = url.UrlObject | url.Url; |
{ | ||
"name": "@types/next", | ||
"version": "2.4.6", | ||
"version": "2.4.7", | ||
"description": "TypeScript definitions for next", | ||
@@ -11,2 +11,7 @@ "license": "MIT", | ||
"githubUsername": "dru89" | ||
}, | ||
{ | ||
"name": "Brice BERNARD", | ||
"url": "https://github.com/brikou", | ||
"githubUsername": "brikou" | ||
} | ||
@@ -24,4 +29,4 @@ ], | ||
}, | ||
"typesPublisherContentHash": "c59e96784f88a8baa177c1c891a6de8c35ca111389526d09f0eb2c4c5a3bbfdb", | ||
"typesPublisherContentHash": "97d7e3d3e0e1f96611b72e4a145fa3a6666e0184159fde7e5c8a5b75a481fbd0", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Sat, 18 Nov 2017 00:40:29 GMT | ||
* Last updated: Wed, 13 Dec 2017 19:13:38 GMT | ||
* Dependencies: http, url, node, react | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Drew Hays <https://github.com/dru89>. | ||
These definitions were written by Drew Hays <https://github.com/dru89>, Brice BERNARD <https://github.com/brikou>. |
@@ -1,3 +0,3 @@ | ||
import * as React from 'react'; | ||
import * as url from 'url'; | ||
import * as React from "react"; | ||
import * as url from "url"; | ||
@@ -17,7 +17,17 @@ type UrlLike = url.UrlObject | url.Url; | ||
// router properties | ||
readonly components: { [key: string]: { Component: React.ComponentType<any>, err: any } }; | ||
readonly components: { | ||
[key: string]: { Component: React.ComponentType<any>; err: any }; | ||
}; | ||
readonly pathname: string; | ||
readonly route: string; | ||
readonly asPath?: string; | ||
readonly query?: { [key: string]: any }; | ||
readonly query?: { | ||
[key: string]: | ||
| boolean | ||
| boolean[] | ||
| number | ||
| number[] | ||
| string | ||
| string[]; | ||
}; | ||
@@ -27,4 +37,12 @@ // router methods | ||
back(): void; | ||
push(url: string|UrlLike, as?: string|UrlLike, options?: EventChangeOptions): Promise<boolean>; | ||
replace(url: string|UrlLike, as?: string|UrlLike, options?: EventChangeOptions): Promise<boolean>; | ||
push( | ||
url: string | UrlLike, | ||
as?: string | UrlLike, | ||
options?: EventChangeOptions, | ||
): Promise<boolean>; | ||
replace( | ||
url: string | UrlLike, | ||
as?: string | UrlLike, | ||
options?: EventChangeOptions, | ||
): Promise<boolean>; | ||
prefetch(url: string): Promise<React.ComponentType<any>>; | ||
@@ -40,5 +58,7 @@ | ||
export function withRouter<T extends {}>(Component: React.ComponentType<T & {router: SingletonRouter}>): React.ComponentType<T>; | ||
export function withRouter<T extends {}>( | ||
Component: React.ComponentType<T & { router: SingletonRouter }>, | ||
): React.ComponentType<T>; | ||
export const Singleton: SingletonRouter; | ||
export default Singleton; |
Sorry, the diff of this file is not supported yet
10576
255