Subscribe is deprecated: Use an observer instead of an error callback

When I run the linter it says: subscribe is deprecated: Use an observer instead of an error callback Code from this angular app: this.userService.updateUser(data).pipe( tap(() => {bla bla bla}) ).subscribe( this.handleUpdateResponse.bind(this), this.handleError.bind(this) ); Don’t know exactly what should I use and how… Thanks! 8 Answers 8

TSLint extension throwing errors in my Angular application running in Visual Studio Code

I recently started seeing, what seems like, TSLint errors. They look like this: Not using the local TSLint version found for ‘/Users/myname/myproject/client/src/app/likes/likee/likee.component.ts’. To enable code execution from the current workspace you must enable workspace library execution. I’m seeing them in my .ts files when I open them and it shows a yellow squiggly line on … Read more

tslint / codelyzer / ng lint error: “for (… in …) statements must be filtered with an if statement”

Lint error message: src/app/detail/edit/edit.component.ts[111, 5]: for (… in …) statements must be filtered with an if statement Code snippet (It is a working code. It is also available at angular.io form validation section): for (const field in this.formErrors) { // clear previous error message (if any) this.formErrors[field] = ”; const control = form.get(field); if (control … Read more

In Typescript, what is the ! (exclamation mark / bang) operator when dereferencing a member?

When looking at the sourcecode for a tslint rule, I came across the following statement: if (node.parent!.kind === ts.SyntaxKind.ObjectLiteralExpression) { return; } Notice the ! operator after node.parent. Interesting! I first tried compiling the file locally with my currently installed version of TS (1.5.3). The resulting error pointed to the exact location of the bang: … Read more