You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Next.js 15.1.3 类型错误求助:Type 'Props' 不满足约束 'PageProps'

Next.js 15.1.3 类型错误求助:Type 'Props' 不满足约束 'PageProps'

老哥,我之前在Next.js 15的App Router项目里也踩过类似的类型坑,先帮你拆解下这个错误的核心:

错误提示里明确说Type 'ModelProps' is missing the following properties from type 'Promise': then, catch, finally, [Symbol.toStringTag],这说明你的ModelProps被错误地推导成了一个Promise类型,而不是普通的页面参数对象类型,导致和Next.js要求的PageProps里的params类型不兼容。

给你几个排查和解决的方向:

  • 先检查ModelProps的定义:是不是不小心把它写成了Promise<{ markaid: string }>这种带Promise包装的类型?如果是,直接去掉Promise的包裹,改成type ModelProps = { markaid: string }这种普通对象类型就行。
  • 检查页面组件的参数类型:你在app/admin/editmodel/[markaid]/page.ts里的页面组件,是不是把params的类型设成了异步类型?比如有没有写async function Page({ params }: { params: ModelProps }),但ModelProps本身是一个Promise?
  • 排查自定义PageProps的冲突:如果你自己手动定义了PageProps类型,会不会和Next.js内置的PageProps结构不一致?比如内置的PageProps的params是普通对象,而你的自定义类型里params是Promise?
  • 快速定位测试:如果暂时找不到问题,可以先把ModelProps替换成明确的字面量类型{ markaid: string },看看错误会不会消失,这样能快速确认是不是类型定义的问题。

你的具体错误日志如下:

.next/types/app/admin/editmodel/[markaid]/page.ts:34:29
Type error: Type '{ params: ModelProps; }' does not satisfy the constraint 'PageProps'.
Types of property 'params' are incompatible.
Type 'ModelProps' is missing the following properties from type 'Promise': then, catch, finally, [Symbol.toStringTag]

32 |
33 | // Check the prop type of the entry function
34 | checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>()
   | ^
35 |
36 | // Check the arguments and return type of the generateMetadata function
37 | if ('generateMetadata' in entry) {
Static worker exited with code: 1 and signal: null

如果按照上面的方向排查后还是解决不了,可以把你page.ts里的组件代码和ModelProps的定义贴出来,我再帮你细抠!

备注:内容来源于stack exchange,提问作者Emirhan S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.14 12:58:08