From 24106b4e6da5c5b99441855b00a579224660fca2 Mon Sep 17 00:00:00 2001 From: Josias Iquabius Date: Sat, 26 Jan 2019 09:04:58 -0300 Subject: [PATCH] Add ErrorTestAppWithState to Next.js' tests --- types/next/test/next-app-tests.tsx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/types/next/test/next-app-tests.tsx b/types/next/test/next-app-tests.tsx index eaa2c0ad07..514cc24436 100644 --- a/types/next/test/next-app-tests.tsx +++ b/types/next/test/next-app-tests.tsx @@ -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 { } } +class ErrorTestAppWithState extends App { + 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 ; + } + + state: {}; // $ExpectError +} + class TestAppWithTypedQuery extends App { static async getInitialProps({ ctx }: NextAppContext) { const { id } = ctx.query;