fix: _app type issues

This commit is contained in:
suemor 2023-04-12 00:20:42 +08:00
parent 6b723656e7
commit 264fbc43fa
No known key found for this signature in database
GPG Key ID: 20170B023BD1CB8B
2 changed files with 20 additions and 2 deletions

View File

@ -19,6 +19,7 @@ import { APP_NAME, IPFS_GATEWAY } from "~/lib/env"
import { toGateway } from "~/lib/ipfs-parser"
import { createIDBPersister } from "~/lib/persister.client"
import { urlComposer } from "~/lib/url-composer"
import { AppPropsWithLayout } from "types/next"
Network.setIpfsGateway(IPFS_GATEWAY)
@ -34,8 +35,8 @@ const queryClient = new QueryClient({
const persister = createIDBPersister()
function MyApp({ Component, pageProps }: any) {
const getLayout = Component.getLayout ?? ((page: any) => page)
function MyApp({ Component, pageProps }: AppPropsWithLayout) {
const getLayout = Component.getLayout ?? ((page) => page)
return (
<WagmiConfig client={wagmiClient}>

17
types/next.ts Normal file
View File

@ -0,0 +1,17 @@
import { DehydratedState } from "@tanstack/react-query"
import { NextPage } from "next"
import { AppProps } from "next/app"
import { ReactElement, ReactNode } from "react"
export type AppPropsWithLayout = AppProps<{
dehydratedState: DehydratedState
}> & {
Component: NextPageWithLayout
}
export type NextPageWithLayout<
P = { dehydratedState: DehydratedState },
IP = P,
> = NextPage<P, IP> & {
getLayout?: (page: ReactElement) => ReactNode
}