Getting a bunch of type errors upon running yarn next build, for example:
Type error: Property 'href' does not exist on type '{ name: string; }'.
Which causes my build to fail. Is there a command i can put in my tsconfig to prevent this from happening?
From NextJS docs: https://nextjs.org/docs/app/api-reference/config/next-config-js/typescript
Just put this lines in next.config.js under the typescript section:
module.exports = {
typescript: {
// !! WARN !!
// Dangerously allow production builds to successfully complete even if
// your project has type errors.
// !! WARN !!
ignoreBuildErrors: true,
},
}
It's very simple if your facing any kind of prettier or typescript error while doing build so the best and simple way to solve just add this below code in your
next.config.js inside const nextConfig = {}
eslint: {
ignoreDuringBuilds: true,
},
typescript: {
ignoreBuildErrors: true,
},
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With