Unexpected deprecation warnings reported

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 */
  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: unknown) => 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: unknown) => void,
    complete?: () => void,
  ): Subscription
}
import { interval } from 'rxjs'

import { TestCase } from './test'

interval(1000).subscribe() // deprecation reported here

new TestCase<number>().subscribe() // not reported which is expected

I can confirm using typescript 4.1.5 is working as expected.

So it’s a compatibility issue with latest ts version.

@saberduck Any luck to take a look at this issue?

Hi,

Please don’t invoke people who aren’t already involved in your thread.

 
Ann

@JounQin I followed the discussion on various tickets, and it seems that this is indeed consequence of Don't inherit jsdoc tags from overloaded signatures by sandersn · Pull Request #43165 · microsoft/TypeScript · GitHub , which should be fixed in TS 4.2 patch, so we should fix it once we upgrade TS Support TypeScript 4.2 · Issue #2511 · SonarSource/SonarJS · GitHub

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.