-
Notifications
You must be signed in to change notification settings - Fork 27k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GetStaticProps type error using latest TypeScript version with strict option set to true #32015
Comments
I'm a first time contributor and I'd like to work on this issue. Should I just go for it or wait to be assigned? |
@vicente-s There is already an open PR, but the author seems to be unresponsive #32023 You could open a new PR and also add |
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
…3042) ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` Closes: vercel#32023 Fixes: vercel#32015
What version of Next.js are you using?
12.0.5-canary.12
What version of Node.js are you using?
12.20.37
What browser are you using?
Chrome
What operating system are you using?
macOS
How are you deploying your application?
npm run build
Describe the Bug
After bumping TypeScript version to latest and enforcing strict mode I am presented with a type error for getStaticProps: GetStaticProps when implementing error catching and validation.
Expected Behavior
I would love for Next.js to have a built in type that accounts for TypeScript latest when run strict (as this is the same configuration found when running
npx create-next-app@latest --typescript
).In the interim, I'd love any guidance to solve the issue as it stands. I am very new to Next.js and TypeScript and just can't figure out exactly what the type error wants me to do. I'd love to be able to build this application without changing strict to false or decrementing the TypeScript version used.
To Reproduce
If you install the Next.js with TypeScript example found here using
npx create-next-app --example with-typescript with-typescript-app
but bump the TypeScript version to the latest stable (4.5.2) and update the strict option to true in the tsconfig file you'll get the following error in ./pages/users/[id].tsx:Which is caused by this TypeScript rule released in v4.4 and true if strict===true. Solving for this issue triggers a type issue for GetStaticProps:
I have a repo here with a handful of commits that demonstrate this process.
The text was updated successfully, but these errors were encountered: