Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error in Angular 5 Project - "An implementation cannot be declared in ambient contexts"

I am using the observable object in an Angular 5 project of mine - up until a week or so ago it was running fine, now all of a sudden I'm getting the following error:

ERROR in node_modules/rxjs/Observable.d.ts(20,31): error TS1183: An implementation cannot be declared in ambient contexts.

I'm a bit of a newbie with Angular so any help would be much appreciated. Thanks!

like image 583
chr15r Avatar asked Feb 20 '18 23:02

chr15r


2 Answers

I tried reinstalling "rxjs" with the following command:

npm install rxjs

This didn't solved my problem.

The only thing that worked for me it was:

Replacing node_module folder with a new one

You can get it from new project or even delete and recreated it by executing:

npm install

Note: I would suggest to take it from new created project, for some reason this command do not work sometimes.

like image 165
Avjol Sakaj Avatar answered Nov 12 '22 09:11

Avjol Sakaj


In Angular 6 my Observables worked, but a "ng build --prod" gave the TS1183 error. My solution was:

npm install rxjs

like image 38
Rob Lassche Avatar answered Nov 12 '22 10:11

Rob Lassche