infer-next-props-type
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

[DEPRECATED] The issue this package fixes is not needed anymore if you are using Next.js >= v12.3.2. More Info.

InferNextPropsType

Gets inferred typings for getStaticProps or getServerSideProps.

Install

npm install infer-next-props-type --save-dev

Usage

getStaticProps

import type InferNextPropsType from 'infer-next-props-type'

export function getStaticProps() {
   return {
     props: { foo: 'bar' }
   }
}

export default function Page(props: InferNextPropsType<typeof getStaticProps>) {
  return ...
}

getServerSideProps

import type InferNextPropsType from 'infer-next-props-type'

export function getServerSideProps() {
   return {
     props: { foo: 'bar' }
   }
}

export default function Page(props: InferNextPropsType<typeof getServerSideProps>) {
  return ...
}

Related

Package Sidebar

Install

npm i infer-next-props-type

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

2.75 kB

Total Files

5

Last publish

Collaborators

  • handtrix