-
I am new to TypeScript and would like to know how I can get this validated by TS. export const getStaticProps: GetStaticPaths = async ({ locale }) =>{
return {
props: {
messages: {
...require(`locales/${locale}.json`),
},
},
};
}
Is there a trick to let know |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Have a look at the example that is linked to in the docs, this should help: next-intl/packages/example/src/pages/index.tsx Lines 17 to 23 in d5d894f |
Beta Was this translation helpful? Give feedback.
-
One mistake: |
Beta Was this translation helpful? Give feedback.
One mistake:
getStaticProps: GetStaticPaths
when it should begetStaticProps: GetStaticProps
.Then like @amannn mentioned
({locale}: GetStaticPropsContext)
to define arguments type.