Skip to content

Commit

Permalink
Add next.js flowtype definition to with-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
mizchi committed Feb 3, 2017
1 parent 3143e0d commit 348feed
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/with-flow/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
[include]

[libs]
types/

[options]
41 changes: 41 additions & 0 deletions examples/with-flow/types/next.js.flow
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
declare module "next" {
declare type NextApp = {
prepare(): Promise<void>;
};
declare module.exports: (...opts: any) => NextApp
}

declare module "next/head" {
declare module.exports: Class<React$Component<void, any, any>>;
}

declare module "next/link" {
declare module.exports: Class<React$Component<void, {href: string}, any>>;
}

declare module "next/prefetch" {
declare module.exports: Class<React$Component<void, {href: string, prefetch?: boolean}, any>>;
}

declare module "next/router" {
declare module.exports: {
route: string;
pathname: string;
query: Object;
onRouteChangeStart: ?((url: string) => void);
onRouteChangeComplete: ?((url: string) => void);
onRouteChangeError: ?((err: Error & {cancelled: boolean}, url: string) => void);
push(url: string, as: ?string): void;
replace(url: string, as: ?string): void;
};
}

declare module "next/document" {
declare export var Head: Class<React$Component<void, any, any>>;
declare export var Main: Class<React$Component<void, any, any>>;
declare export var NextScript: Class<React$Component<void, any, any>>;
declare export default Class<React$Component<void, any, any>> & {
getInitialProps: (ctx: any) => Promise<any>;
renderPage(cb: Function): void;
};
}

0 comments on commit 348feed

Please sign in to comment.