⛔ [DEPRECATED] The issue this package fixes is not needed anymore if you are using Next.js >= v12.3.2
. More Info.
Gets inferred typings for getStaticProps
or getServerSideProps
.
npm install infer-next-props-type --save-dev
import type InferNextPropsType from 'infer-next-props-type'
export function getStaticProps() {
return {
props: { foo: 'bar' }
}
}
export default function Page(props: InferNextPropsType<typeof getStaticProps>) {
return ...
}
import type InferNextPropsType from 'infer-next-props-type'
export function getServerSideProps() {
return {
props: { foo: 'bar' }
}
}
export default function Page(props: InferNextPropsType<typeof getServerSideProps>) {
return ...
}