我升级到了18号反应堆,一切正常。如今,似乎每个使用子元素的组件都抛出了一个错误。Property 'children' does not exist on type 'IPageProps'.
以前儿童道具是自动包含在 FC
界面。现在看来我必须手动添加 children: ReactNode
.反应儿童的正确打字类型是什么?
这是18号反应堆更新的一部分,还是我的环境出了问题?
包裹 Json
"react": "^18.0.0",
"react-dom": "^18.0.0",
"next": "12.1.4",
"@types/react": "18.0.0",
"@types/react-dom": "18.0.0",
tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
"alwaysStrict": true,
"sourceMap": true,
"incremental": true
},
"include": ["src"],
"exclude": ["node_modules"]
}