mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-30 02:01:46 +00:00
[next] Added typings for next/app
This commit is contained in:
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
import * as React from "react";
|
||||
|
||||
export interface AppComponentProps {
|
||||
Component: React.ComponentType<any>;
|
||||
pageProps: any
|
||||
}
|
||||
|
||||
export class Container extends React.Component {}
|
||||
|
||||
export default class App<P = {}> extends React.Component<P & AppComponentProps> {}
|
||||
@@ -0,0 +1,27 @@
|
||||
import * as React from "react";
|
||||
import App, { Container } from "next/app";
|
||||
|
||||
interface NextComponentProps {
|
||||
example: string;
|
||||
}
|
||||
|
||||
class TestApp extends App<NextComponentProps> {
|
||||
static async getInitialProps({ Component, router, ctx }: any) {
|
||||
let pageProps = {};
|
||||
|
||||
if (Component.getInitialProps) {
|
||||
pageProps = await Component.getInitialProps(ctx);
|
||||
}
|
||||
|
||||
return { pageProps };
|
||||
}
|
||||
|
||||
render() {
|
||||
const { Component, pageProps } = this.props;
|
||||
return (
|
||||
<Container>
|
||||
<Component {...pageProps} />
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@
|
||||
"router.d.ts",
|
||||
"config.d.ts",
|
||||
"test/next-tests.ts",
|
||||
"test/next-app-tests.tsx",
|
||||
"test/next-error-tests.tsx",
|
||||
"test/next-head-tests.tsx",
|
||||
"test/next-document-tests.tsx",
|
||||
|
||||
Reference in New Issue
Block a user