Topic: [NODE] mdb.min.js implicitly has an any type.

maksam07 free asked 5 months ago


Good afternoon. I imported mdb via npm:

npm i mdb-ui-kit

, added the lines specified in the documentation to my files and my ide showed an error:ts error

My tsconfig.json is set to "noImplicitAny": true, and ide sees these issuesI've seen a similar thread on the forum before: https://mdbootstrap.com/support/react/typescript-implementation/

The last reply was 7 months ago and it was for react.

Can you suggest the best way to solve this problem at this time?


Grzegorz Bujański staff answered 5 months ago


MDB Standard is a project written in pure JS. Therefore, it has no type declaration. You have 3 options to deal with this error:

  1. create mdb-ui-kit.d.ts inside your src directory and add declare module 'mdb-ui-kit'; in it.
  2. add // @ts-ignore above MDB import
  3. add "noImplicitAny": false to your tsconfig.json file

maksam07 free commented 5 months ago

Yes, I'm using the second option right now, it seems the most acceptable, but I was wondering if there is a better solution so I don't ignore the problem


Grzegorz Bujański staff commented 5 months ago

I suggest solution 1. This is the default solution you can find in the hint about this error.

There is no other solution you can use. Of course, the best solution is rewriting MDB to TS. We consider this. But at the moment I can't guarantee you that we will do it or when we do it.



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 6.4.2
  • Device: PC
  • Browser: Chrome
  • OS: Kubuntu
  • Provided sample code: No
  • Provided link: Yes
Tags