pemola
(pemola)
April 9, 2021, 6:48am
3
Hello,
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’m trying to use the internal rule deprecation from SonarJS , but there are unexpected deprecation warnings reported.
It works like the deprecated tslint's same rule which reports warnings too.
related
// test.ts
export interface PartialObserver<T> {
value: T
}
export interface Subscription {
unsubscribe(): void
}
export declare class TestCase<T = unknown> {
subscribe(observer?: PartialObserver<T>): Subscription
/** @deprecated Use an observer instead of a complete callback */
s…
opened 01:25AM - 03 Mar 21 UTC
closed 07:54PM - 07 Apr 21 UTC
Needs Investigation
Fix Available
# Bug Report
### 🔎 Search Terms
RxJS Deprecation Warning TSLint ESLint VSC… ode Signature Doc Tags DocTags
### 🕗 Version & Regression Information
Since TypeScript v4.2.2, I get deprecation warnings with RxJS, that I was not getting in TypeScript v4.1.5
I first opened an issue on RxJS ([here](https://github.com/ReactiveX/rxjs/issues/6060)), but it may be a TypeScript issue
### 💻 Code
```ts
import { Observable, Subject } from 'rxjs';
const somethingHappened: Subject<void> = new Subject();
const somethingHappened$: Observable<void> = somethingHappened.asObservable();
// Deprecation warning on the next line
somethingHappened$.subscribe(() => {
console.log('something happened');
});
somethingHappened.next();
```
### 🙁 Actual behavior
When I subscribe to the observable, I get the deprecation warning `subscribe is deprecated: Use an observer instead of a complete callback` even though I'm not using any complete callback
It occurs with both TSLint v6.1.3 and ESLint v7.21.0 (using eslint-plugin-deprecation v1.2.0)
Here are the signatures for the `subscribe` method in RxJS v6.6.6 :
```ts
subscribe(observer?: PartialObserver<T>): Subscription;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: null | undefined, error: null | undefined, complete: () => void): Subscription;
/** @deprecated Use an observer instead of an error callback */
subscribe(next: null | undefined, error: (error: any) => void, complete?: () => void): Subscription;
/** @deprecated Use an observer instead of a complete callback */
subscribe(next: (value: T) => void, error: null | undefined, complete: () => void): Subscription;
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
```
If I understand this correctly, in my case it should be using this signature :
```ts
subscribe(next?: (value: T) => void, error?: (error: any) => void, complete?: () => void): Subscription;
```
Which is not deprecated
### 🙂 Expected behavior
There should be no deprecation warning