@types/next
Advanced tools
Comparing version 2.4.2 to 2.4.3
@@ -9,170 +9,57 @@ // Type definitions for next 2.4 | ||
declare module 'next' { | ||
import * as http from 'http'; | ||
import * as url from 'url'; | ||
import * as http from 'http'; | ||
import * as url from 'url'; | ||
namespace next { | ||
type UrlLike = url.UrlObject | url.Url; | ||
declare namespace next { | ||
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; | ||
} | ||
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>; | ||
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>; | ||
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; | ||
} | ||
// and since this is a config, it can take anything else, too. | ||
[key: string]: any; | ||
} | ||
function next(options?: next.ServerOptions): next.Server; | ||
export = next; | ||
} | ||
declare module 'next/error' { | ||
import * as React from 'react'; | ||
export default class extends React.Component<{statusCode: number}, {}> {} | ||
} | ||
declare module 'next/head' { | ||
import * as React from 'react'; | ||
function defaultHead(): JSX.Element[]; | ||
export default class extends React.Component<{}, {}> { | ||
static canUseDOM: boolean; | ||
static peek(): Array<React.ReactElement<any>>; | ||
static rewind(): Array<React.ReactElement<any>>; | ||
} | ||
} | ||
declare module 'next/document' { | ||
import * as React from 'react'; | ||
interface DocumentProps { | ||
__NEXT_DATA__?: any; | ||
interface ServerOptions { | ||
dir?: string; | ||
dev?: boolean; | ||
chunks?: string[]; | ||
head?: Array<React.ReactElement<any>>; | ||
styles?: Array<React.ReactElement<any>>; | ||
[key: string]: any; | ||
staticMarkup?: boolean; | ||
quiet?: boolean; | ||
conf?: ServerConfig; | ||
} | ||
class Head extends React.Component<any, {}> {} | ||
class Main extends React.Component<{}, {}> {} | ||
class NextScript extends React.Component<{}, {}> {} | ||
export default class extends React.Component<DocumentProps, {}> {} | ||
} | ||
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>; | ||
declare module 'next/link' { | ||
import * as url from 'url'; | ||
import * as React from 'react'; | ||
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>; | ||
type UrlLike = url.UrlObject | url.Url; | ||
interface LinkState { | ||
prefetch?: boolean; | ||
shallow?: boolean; | ||
scroll?: boolean; | ||
replace?: boolean; | ||
onError?(error: any): void; | ||
href?: string | UrlLike; | ||
as?: string | UrlLike; | ||
children: React.ReactElement<any>; | ||
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; | ||
} | ||
export default class extends React.Component<LinkState, {}> {} | ||
} | ||
declare module 'next/dynamic' { | ||
import * as React from 'react'; | ||
interface DynamicOptions<TCProps, TLProps> { | ||
loading?: React.ComponentType<TLProps>; | ||
ssr?: boolean; | ||
modules?(props: TCProps & TLProps): { [key: string]: Promise<React.ComponentType<any>> }; | ||
render?(props: TCProps & TLProps, modules: { [key: string]: React.ComponentType<any> }): void; | ||
} | ||
class SameLoopPromise<T> extends Promise<T> { | ||
constructor(executor: (resolve: (value?: T) => void, reject: (reason?: any) => void) => void); | ||
setResult(value: T): void; | ||
setError(value: any): void; | ||
runIfNeeded(): void; | ||
} | ||
export default function<TCProps, TLProps>(componentPromise: Promise<React.ComponentType<TCProps>>, options?: DynamicOptions<TCProps, TLProps>): React.ComponentType<TCProps & TLProps>; | ||
} | ||
declare module 'next/router' { | ||
import * as React from 'react'; | ||
interface EventChangeOptions { | ||
shallow?: boolean; | ||
[key: string]: any; | ||
} | ||
type RouterCallback = () => void; | ||
interface SingletonRouter { | ||
readyCallbacks: RouterCallback[]; | ||
ready(cb: RouterCallback): void; | ||
// router properties | ||
readonly components: { [key: string]: { Component: React.ComponentType<any>, err: any } }; | ||
readonly pathname: string; | ||
readonly route: string; | ||
readonly asPath?: string; | ||
readonly query?: { [key: string]: any }; | ||
// router methods | ||
reload(route: string): Promise<void>; | ||
back(): void; | ||
push(url: string, as?: string, options?: EventChangeOptions): Promise<boolean>; | ||
replace(url: string, as?: string, options?: EventChangeOptions): Promise<boolean>; | ||
prefetch(url: string): Promise<React.ComponentType<any>>; | ||
// router events | ||
onAppUpdated?(nextRoute: string): void; | ||
onRouteChangeStart?(url: string): void; | ||
onBeforeHistoryChange?(as: string): void; | ||
onRouteChangeComplete?(url: string): void; | ||
onRouteChangeError?(error: any, url: string): void; | ||
} | ||
const Singleton: SingletonRouter; | ||
export default Singleton; | ||
} | ||
declare function next(options?: next.ServerOptions): next.Server; | ||
export = next; |
{ | ||
"name": "@types/next", | ||
"version": "2.4.2", | ||
"version": "2.4.3", | ||
"description": "TypeScript definitions for next", | ||
@@ -9,3 +9,4 @@ "license": "MIT", | ||
"name": "Drew Hays", | ||
"url": "https://github.com/dru89" | ||
"url": "https://github.com/dru89", | ||
"githubUsername": "dru89" | ||
} | ||
@@ -20,8 +21,7 @@ ], | ||
"dependencies": { | ||
"@types/react": "*", | ||
"@types/node": "*" | ||
"@types/node": "*", | ||
"@types/react": "*" | ||
}, | ||
"peerDependencies": {}, | ||
"typesPublisherContentHash": "012331319b64acb1334319956595c855595fca8a699c3d74857533b6d79e9c7c", | ||
"typesPublisherContentHash": "c1cab95236d9e4917292bc09de075622d1b267ccf812bd48b53e134dc0e847db", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,4 +11,4 @@ # Installation | ||
Additional Details | ||
* Last updated: Fri, 28 Jul 2017 19:49:07 GMT | ||
* Dependencies: http, url, react, node | ||
* Last updated: Tue, 26 Sep 2017 18:18:49 GMT | ||
* Dependencies: http, url, node, react | ||
* Global values: none | ||
@@ -15,0 +15,0 @@ |
10
8145
134