Losing typesafety after wrapping json import in a function

I'm trying to follow this guide of localization for next13 where an import of json is made where the object is typesafe but when i return the object from a function there is non. I'm not very well versed in typescript, thanks in advanced!
Routing: Internationalization | Next.js
Add support for multiple languages with internationalized routing and localized content.
1 Reply
Урош
Урош2mo ago
Solved it. The locale expects a key or either 'en' or 'nl' so a union of those to as paramaters will solve the type safety issue but does anyone perhaps know why that is needed and just writing a string doesn't solve the issue? upon further reading it seems that having defined keys of languages provides stronger type checking compared to when it's just a string which doesn't really provide the tsc with any usefull info I would assume.
Want results from more Discord servers?
Add your server