Topic: [NODE] mdb.min.js implicitly has an any type.
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:
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 a year 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:
- create
mdb-ui-kit.d.ts
inside yoursrc
directory and adddeclare module 'mdb-ui-kit';
in it. - add
// @ts-ignore
above MDB import - add
"noImplicitAny": false
to yourtsconfig.json
file
maksam07 commented a year 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 a year 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.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: 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