mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add ErrorTestAppWithState to Next.js' tests
This commit is contained in:
parent
af36b57821
commit
24106b4e6d
@ -6,6 +6,10 @@ interface TestAppProps {
|
||||
pageProps: any;
|
||||
}
|
||||
|
||||
interface TestAppState {
|
||||
color: string;
|
||||
}
|
||||
|
||||
interface TypedQuery extends DefaultQuery {
|
||||
id?: string;
|
||||
}
|
||||
@ -33,6 +37,20 @@ class TestAppWithProps extends App<TestAppProps & WithExampleProps> {
|
||||
}
|
||||
}
|
||||
|
||||
class ErrorTestAppWithState extends App<TestAppProps & WithExampleProps, TestAppState> {
|
||||
static async getInitialProps({ Component, router, ctx }: NextAppContext) {
|
||||
const pageProps = Component.getInitialProps && (await Component.getInitialProps(ctx));
|
||||
return { pageProps };
|
||||
}
|
||||
|
||||
render() {
|
||||
const { Component, router, pageProps, example } = this.props;
|
||||
return <Component {...pageProps} example={example} />;
|
||||
}
|
||||
|
||||
state: {}; // $ExpectError
|
||||
}
|
||||
|
||||
class TestAppWithTypedQuery extends App {
|
||||
static async getInitialProps({ ctx }: NextAppContext<TypedQuery>) {
|
||||
const { id } = ctx.query;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user