构建Turborepo项目时遭遇奇怪的TypeScript类型错误
TurboRepo模板开发中TypeScript类型错误问题
我正在使用turborepo-template进行开发,之前一切正常,但突然TypeScript开始抛出奇怪的类型错误:
../../packages/fork-me/src/client/star-me/star-me.tsx:19:4 nextjs-example:build: Type error: Type 'string | number | true | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode>' is not assignable to type 'ReactNode'. nextjs-example:build: Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'. nextjs-example:build: Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'. nextjs-example:build: nextjs-example:build: 17 | return ( nextjs-example:build: 18 | <button data-testid="star-me-h1" onClick={starMe} type="button" {...props}> nextjs-example:build: > 19 | {children || "Star Me"} nextjs-example:build: | ^ nextjs-example:build: 20 | </button> nextjs-example:build: 21 | ); nextjs-example:build: 22 | }
错误指向packages/fork-me/src/client/star-me/star-me.tsx文件。奇怪的是,单独打包这个包时没有任何错误,但构建示例项目时却会触发这个错误。
内容的提问来源于stack exchange,提问作者Mayank Kumar Chaudhari
相关产品推荐
相关产品推荐

