Issue
I have setup new Typescript/React project, getting this error message in the tsconfig.json file
"Cannot find type definition file for 'bson'. The file is in the program because: Entry point for implicit type library 'bson'"
any ideas.
here is my tsconfig.json
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}
Solution
Found the solution on github
These errors occur when you have subdirectories of a typeRoots directory (in this case node_modules/@types) that do not contain index.d.ts
For me, the problem was because I was creating a library that did exported a bunch of interfaces
& types
Here is an example
types-folder
├─── index.d.ts
└─── child-folder
└─── index.d.ts // <-- Mandatory
Answered By - Raphaël Balet
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.