question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not find a declaration file for module

See original GitHub issue

Describe 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:

  1. npm install @brazilian-utils/is-valid-cpf --save
  2. import isValidCpf from '@brazilian-utils/is-valid-cpf';
  3. See error

Expected behavior It should import with no problem

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
hyanmandiancommented, Aug 27, 2019

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 😦

0reactions
hyanmandiancommented, Jan 15, 2020

I did this example to show typings working in v1 version (current) https://codesandbox.io/s/brazilian-utils-typescript-example-6fhmt

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found