Search code examples
node.jsreactjsreact-admin

Issues with changing locale in react-admin: language package "implicitly has an 'any' type"


Im trying to follow this official guide on how to do internationalization in react-admin. I install the language pack using npm install aor-language-swedish, and change from aor to ra in index.js of aor-language-swedish in order to make it work it react-admin instead of admin on REST (I have also tried the English pack whcih is natively supported in react-admin, but I get the same error described below).

I then try to do import swedishMessages from "aor-language-swedish"; in my App.js but upon hovering the import, i get the error:

Could not find a declaration file for module 'aor-language-swedish'. 
'c:/Users/ssm/Documents/Visual Studio Code/adminui/node_modules/aor- 
language-swedish/index.js' implicitly has an 'any' type.
Try `npm install @types/aor-language-swedish` if it exists or add a new 
declaration (.d.ts) file containing `declare module 'aor-language- 
swedish';

What could be causing this error? I have looked around the internet, but to no avail.


Solution

  • It turns out that this problem was not in fact a problem. Ignoring it seems to work, and remember to change the root key in index.js of the package to ra instead of aor if you are using an older react-admin language module (like Swedish). However, it would be interesting to know why this warning is shown, as I am not using TypeScript. Might it be an extension that is causing this warning?