Importing @dhis2/ui error


I want to use dhis2/ui library in developing DHIS2 APP react app. While importing the dhis2/ui, I get the following error when I hover over the three dots:

Could not find a declaration file for module '@dhis2/ui'. 'C:/Users/Administrator/myapp/node_modules/@dhis2/ui/build/cjs/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/dhis2__ui` if it exists or add a new declaration (.d.ts) file containing `declare module '@dhis2/ui';`ts(7016)
  Try `npm i --save-dev @types/dhis2__ui` if it exists or add a new declaration (.d.ts) file containing `declare module '@dhis2/ui';`ts(7016)

Any help would be appreciated. Thanks

Hello @Orly_MUGWANEZA

It seems you are using typescript to develop your app if I’m not mistaken. Unfortunately, the @dhis2/ui library does not have types yet. To get rid of that error you can create a d.ts file (index.d.ts, for example) anywhere in the src directory (I recommend in the src folder itself, or in a new folder) of your app and within that file declare the module as:

declare module "@dhis2/ui";

You can do this for any package/library that does not have types.