I can’t add a JS libarary to my TS project. I installed a JS library.
I get the following error, when i try to run a server:
`Could not find a declaration file for module 'lyrics-finder'. '' implicitly has an 'any' type.
Try `npm i --save-dev @types/lyrics-finder` if it exists or add a new declaration (.d.ts) file containing `declare module 'lyrics-finder';``
This library does not have @types/lyrics-finder, so I need to create a new declaration, but I keep failing.
I created lyrics-finder.d.ts file:
`declare module 'lyrics-finder' {
export default function lyricsFinder(artist: string | undefined, title: string | undefined): Promise<string | null>;
}`
I put this in types folder. Then I updated a tsconfig.json (added “typeRoots”, “baseUrl”)
*{
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "DOM.Iterable", "ESNext"],
"module": "ESNext",
"typeRoots": ["src/types"],
"declaration": true,
"baseUrl": "src",
/* Bundler mode */
"moduleResolution": "node",
"allowSyntheticDefaultImports": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},*
But all of this did not help and I am still getting the same error that module is not founded.
Do you have any ideas why?