Skip to content

Commit 348feed

Browse files
committed
Add next.js flowtype definition to with-flow
1 parent 3143e0d commit 348feed

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

examples/with-flow/.flowconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
[include]
44

55
[libs]
6+
types/
67

78
[options]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
declare module "next" {
2+
declare type NextApp = {
3+
prepare(): Promise<void>;
4+
};
5+
declare module.exports: (...opts: any) => NextApp
6+
}
7+
8+
declare module "next/head" {
9+
declare module.exports: Class<React$Component<void, any, any>>;
10+
}
11+
12+
declare module "next/link" {
13+
declare module.exports: Class<React$Component<void, {href: string}, any>>;
14+
}
15+
16+
declare module "next/prefetch" {
17+
declare module.exports: Class<React$Component<void, {href: string, prefetch?: boolean}, any>>;
18+
}
19+
20+
declare module "next/router" {
21+
declare module.exports: {
22+
route: string;
23+
pathname: string;
24+
query: Object;
25+
onRouteChangeStart: ?((url: string) => void);
26+
onRouteChangeComplete: ?((url: string) => void);
27+
onRouteChangeError: ?((err: Error & {cancelled: boolean}, url: string) => void);
28+
push(url: string, as: ?string): void;
29+
replace(url: string, as: ?string): void;
30+
};
31+
}
32+
33+
declare module "next/document" {
34+
declare export var Head: Class<React$Component<void, any, any>>;
35+
declare export var Main: Class<React$Component<void, any, any>>;
36+
declare export var NextScript: Class<React$Component<void, any, any>>;
37+
declare export default Class<React$Component<void, any, any>> & {
38+
getInitialProps: (ctx: any) => Promise<any>;
39+
renderPage(cb: Function): void;
40+
};
41+
}

0 commit comments

Comments
 (0)