JSPM

infer-next-props-type

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 873
  • Score
    100M100P100Q112076F
  • License MIT

Gets inferred typings for getStaticProps or getServerSideProps.

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (infer-next-props-type) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    [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 ...
    }