Could not find a declaration file for module
See original GitHub issueDescribe the bug
Could not find a declaration file for module '@brazilian-utils/is-valid-cpf'. 'node_modules/@brazilian-utils/is-valid-cpf/dist/index.js' implicitly has an 'any' type.
Try `npm install @types/brazilian-utils__is-valid-cpf` if it exists or add a new declaration (.d.ts) file containing `declare module '@brazilian-utils/is-valid-cpf';`ts(7016)
Same with
import isValidCnpj from '@brazilian-utils/is-valid-cnpj';
or
import { isValidCpf, isValidCnpj } from '@brazilian-utils/validators';
To Reproduce Steps to reproduce the behavior:
npm install @brazilian-utils/is-valid-cpf --save
import isValidCpf from '@brazilian-utils/is-valid-cpf';
- See error
Expected behavior It should import with no problem
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (7 by maintainers)
Top Results From Across the Web
Could not find a declaration file for module 'module-name ...
In order for this to work, I had to make declare module '...' the first line of code in the module.d.ts file, and...
Read more >Could not find declaration file for module 'X' Error | bobbyhadz
The error "Could not find a declaration file for module" occurs when TypeScript cannot find the type declaration for a module. To solve...
Read more >How to fix error TS7016: Could not find a declaration file for ...
Try `npm install @types/XYZ` if it exists or add a new declaration (.d. · declare module 'XYZ';. Lastly, you also need to add...
Read more >Fixing the TS7016 Error | Atomist Blog
4 Terrible Ways (and 4 Better Ways) to fix 'TS7016: Could not find declaration file' · Caveat: the compiler option --noEmitOnError makes ...
Read more >Could not find a declaration file for module 'mongodb ... - Reddit
Could not find a declaration file for module 'mongodb', despite library saying the types are included. I'm using NextJS and Typescript, with ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks, @ricardovf. If you have free time and know how to fix, contributions are welcome. Right now we are trying to refactor the entire project but things are going slow 😦
I did this example to show typings working in v1 version (current) https://codesandbox.io/s/brazilian-utils-typescript-example-6fhmt