Binding element 'children' implicitly has an 'any' type.ts(7031) in Next.jsnext-intl - Stack Ove

I have recently created my first webapp with Next.js and I was using next-intl for offering multiple la

I have recently created my first webapp with Next.js and I was using next-intl for offering multiple languages. I implemented it as described on their website which worked just fine. Also I have added localised not-found pages following this tutorial /docs/environments/error-files#not-foundjs . This also worked just fine when testing localy with "npm run dev", however when I try to build the app I get an error from the root layout.tsx file saying " Type error: Binding element 'children' implicitly has an 'any' type.".

My file (app/layout.tsx) looks exactly as the one provided by next-intl but I put it in here aswell just to be sure:

export default function RootLayout({children}) {
  return children;
}

What can I do to fix this error? I tried searching in the next-intl documentation and later also looked online, however I could not find any solution that would work. I would appreciate help from anyone who points me in the right direction. Also please excuse me if its someting really simple, I am quite new to this.

I have recently created my first webapp with Next.js and I was using next-intl for offering multiple languages. I implemented it as described on their website which worked just fine. Also I have added localised not-found pages following this tutorial https://next-intl.dev/docs/environments/error-files#not-foundjs . This also worked just fine when testing localy with "npm run dev", however when I try to build the app I get an error from the root layout.tsx file saying " Type error: Binding element 'children' implicitly has an 'any' type.".

My file (app/layout.tsx) looks exactly as the one provided by next-intl but I put it in here aswell just to be sure:

export default function RootLayout({children}) {
  return children;
}

What can I do to fix this error? I tried searching in the next-intl documentation and later also looked online, however I could not find any solution that would work. I would appreciate help from anyone who points me in the right direction. Also please excuse me if its someting really simple, I am quite new to this.

Share Improve this question asked Mar 24 at 21:05 Petr PravdaPetr Pravda 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

It looks like you are using typescript so you have to write type for each props For this example this is the code you should write

{children}: {children: React.ReactNode} Here is the type for children

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744228542a4564127.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信