yehonatan yehezkel
yehonatan yehezkel

Reputation: 1246

Could not find a declaration file for module 'rxjs'

i use rxjs with typescript but i got the next ERROR

Could not find a declaration file for module 'rxjs'.'C:/Path/to/project/node_modules/rxjs/dist/cjs/index.js'

typescript version 4.7.4 

rxjs version 7.5.6

working with vscode 1.59

i create new angular 14 app. to solve this i tried to upgrade the typescript version like i saw inw the github issue that it solved afer typescript 4.2 and above but i still have the error

how to solve the versiong problem ?

Upvotes: 5

Views: 5354

Answers (2)

Valerij Dobler
Valerij Dobler

Reputation: 2804

I've experienced the same error message but it was just in IntelliJ, the project compiled and ran just fine. Error when hovering

The issue was, that IntelliJ found an older Typescript version from a different frontend.

After assigning the correct TypeScript and restarting the TypeScript Service(bottom right of the editor) the error went away.

Restart ts service

If you are using 7.5.4: just update (source: https://github.com/ReactiveX/rxjs/issues/6822)

Upvotes: 3

yehonatan yehezkel
yehonatan yehezkel

Reputation: 1246

the error was show only on the vscode and not on the tsc in the terminal. so i understood that the problem was in the vscode typescript internal server. . it has older typescript version then rxjs 7 need.... so i upgrade th vscode version to 1.69 and it was solved

you also can change the vscode ts version manually see this answer What TypeScript version is Visual Studio Code using? How to update it?

Upvotes: 3

Related Questions