Automatically adds types to your Next.js page components if you use getStaticSideProps or getServerSideProps.
The returned types can not be automatically inferred and passed to the page.
This extension also enables type safety in js code by leveraging JsDocs.
A Project with next as a dependency in your package.json
| Name | Description | Default |
|---|---|---|
WillLuke.nextjs.root |
Option to set the path to a nextjs project | |
WillLuke.nextjs.hasPrompted |
Hides Autotypes Prompt if it has been shown | false |
WillLuke.nextjs.addTypesOnSave |
Automatically add NextJS page types on save | false |
WillLuke.debug |
Debug the Extension | false |
- Install the extension
- Install the example
git clone https://github.com/williamluke4/vscode-next-types-example
yarn
- Open VSCode
- Accept Autotypes Prompt
- Navigate to
pages/songs/[id].tsxorpages/ssr-songs/[id].jsx - Hit Save
ctrl-sorctrl-pthen search types
- Workspaces not Supported
git clone https://github.com/prisma-labs/vscode-next.git
cd vscode-next
yarnUse VSCode built in debugger and select Run Extension
yarn pkg

