Furkan Karacan
Furkan Karacan

Reputation: 192

Could not find a declaration file for module 'rxjs'. implicitly has an 'any' type. Try `npm i --save-dev @types/rxjs or add a new declaration

I am trying to import Subject and fromEvent from rxjs as below.

import { Subject } from "rxjs";
import { fromEvent, Subject } from 'rxjs';

The error i specified in the title shows up in the console.

This is my package.json dependencies:

  "dependencies": {
    "@types/node": "^10.12.18",
    "@types/powerapps-component-framework": "^1.2.0",
    "bootstrap": "^5.0.1",
    "jquery": "^3.6.0",
    "popper.js": "^1.16.1",
    "rxjs": "^7.1.0"
  },

Upvotes: 4

Views: 5530

Answers (2)

Jonny
Jonny

Reputation: 305

Your TypeScript version is likely out of date. The breaking changes for RxJS 7 denote:

TS: RxJS requires TS 4.2

Using an outdated version will yield that error. Updating your TS version to the latest should also solve this.

Upvotes: 7

Furkan Karacan
Furkan Karacan

Reputation: 192

I changed my rxjs version from 7 to 6.5.4 and its fixed

Upvotes: 4

Related Questions