Typescript deprecation false-positives

Template for a good false-positive report, formatted with Markdown:

  • versions used: SonarCloud, SonarScanner 4.4.0 (tried 4.6.0-2311 and that didn’t help)

  • minimal code sample to reproduce (with analysis parameter, and potential instructions to compile).

import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';

  selector: 'sonar-rxjs-issue-demo',
  template: '<h1>Hello World!</h1>'
export class SonarRxJSIssueDemoComponent {

  constructor(private http: HttpClient) {

  method1() {
      .subscribe(() => console.log('Next1'));// shouldn't be marked as deprecated https://github.com/ReactiveX/rxjs/blob/6.6.3/src/internal/Observable.ts#L80

  method2(): void {
      .subscribe({ next: () => console.log('Next2') }); // shouldn't be marked as deprecated https://github.com/ReactiveX/rxjs/blob/6.6.3/src/internal/Observable.ts#L73

This afternoon (3/26/21), my pipelines started to suddenly fail due to a sudden increase in Sonar issues with my Typescript code (Angular 11.0.8 with RxJs 6.6.3). Looks like the scanner started to flag any use of the subscribe method of the RxJS observable class as issues (Deprecated APIs should not be used, minor code smell).

Tried to change things around and noticed this is affecting all uses of the subscribe method overloads, even the non-deprecated ones. Found this thread that mentioned something similar (Unexpected deprecation warnings reported - #3 by JounQin), and from what I can tell the related SonarJS change was released today (related to my issue? not sure).

I was originally running TypeScript 4.0.5 and tried to upgrade to 4.2.3 and that didn’t help. Also tried to upgrade my sonar-scanner to 4.6.0, which also didn’t help.

Can you look into this and advise on how to resolve it?

edit: grammar and formatting


I had the same problem, but It fixed alone. Today we get the same problem. What’s wrong?


I think it’s because of new versión of sonar-javascript-plugin that references to typescript 4.2.3.
Wich version have your Sonarcloud of this plugin? You could try with prior versions.

See this links:

I have the same problem. Does anybody know how to fix it?

1 Like