I use Nextjs, typescript and next-intl.
in my layout.tsx i have following code:
import {NextIntlClientProvider} from 'next-intl';
import {getMessages} from 'next-intl/server';
export default async function RootLayout({
children,
params: {locale}
}: Readonly<{
children: React.ReactNode;
params: {locale: string};
}>) {
const messages = await getMessages();
return (
<html lang={locale} className="scroll-smooth">
<body className={inter.className}>
<header className="fixed bg-black w-full "><Navigation locale={locale} menu1={messages.Menu.menu1} menu2={messages.Menu.menu2} submenu1={messages.Menu.submenu1} submenu2={messages.Menu.submenu2}/></header>
My en.json file looks like:
{
"Menu": {
"menu1": "first",
"menu2": "second",
"submenu1": "sub1",
"submenu2": "sub2"
}
}
if i run the site local it works fine but i cant make a build. reason ist that when i call the value menu1={messages.Menu.menu1}
I got this message in vscode:
Property 'menu1' does not exist on type 'string | AbstractIntlMessages'.
Property 'menu1' does not exist on type 'string'.ts(2339)
any
how can i fix this
if i run the site local it works fine but i cant make a build. reason ist that when i call the value menu1={messages.Menu.menu1}
I got this message in vscode:
Property 'menu1' does not exist on type 'string | AbstractIntlMessages'.
Property 'menu1' does not exist on type 'string'.ts(2339)
any
how can i fix this your text