Noo*_*oob 8 javascript typescript reactjs next.js
运行时出现一堆类型错误yarn next build,例如:
Type error: Property 'href' does not exist on type '{ name: string; }'.
这导致我的构建失败。我可以在 tsconfig 中添加一个命令来防止这种情况发生吗?
小智 22
来自 NextJS 文档:https://nextjs.org/docs/api-reference/next.config.js/ignoring-typescript-errors
只需将此行放入 typescript 部分下的 next.config.js 中:
module.exports = {
  typescript: {
    // !! WARN !!
    // Dangerously allow production builds to successfully complete even if
    // your project has type errors.
    // !! WARN !!
    ignoreBuildErrors: true,
  },
}| 归档时间: | 
 | 
| 查看次数: | 21315 次 | 
| 最近记录: |