Rxjs: deprecation warning when using of as intended

Created on 23 Apr 2019  路  16Comments  路  Source: ReactiveX/rxjs

Bug Report

Current Behavior

I've got the tslint rule "deprecation": true enabled and it is now throwing warnings when using of without a scheduler.

Reproduction

import { of } from "rxjs"

of(4) // of is deprecated: use {@link scheduled} instead `scheduled([a, b, c], scheduler)` (deprecation)

Expected behavior
No warning

Environment

  • Runtime: Node v11.13.0
  • RxJS version: 6.5.1
  • tslint version 5.16.0

Most helpful comment

Well, I might sound like a dick here. But ... it's a minor bug, that what fixed immediately after it's been spotted by (at least) hundreds ppl. 2 weeks passes and it's not released. I know, I know. Just a bit frustrating.

All 16 comments

As described here, only the version of "of" which accepts a scheduler should be deprecated: https://github.com/ReactiveX/rxjs/pull/4595 So, it's definitely a bug.

I think these two lines should be moved to the bottom of the declaration file

/** @deprecated use {@link scheduled} instead `scheduled([a, b, c], scheduler)` */
export declare function of<T>(...args: (T | SchedulerLike)[]): Observable<T>;

@evertbouw Yes, they need to be placed below:

export function of<T>(...args: T[]): Observable<T>;

@evertbouw If you would like to open a PR, please let me know. Otherwise, I'll open one myself.

@cartant I can do it

I see the same problem with startWith

@nlaplante If there is a problem with startWith it would be better to open another issue. This one will be closed when the PR is merged. Anyway, if there is a problem with that operator's deprecations, it appears to be to be different to this issue, as the signature is already in the correct place.

I have the same problem.

I see the same problem with startWith

I had the problem with startWith when I was using startWith(void 0). I changed it to startWith(0) and now it works without showing any deprecation warning.

@imransilvake As mentioned above, please open a new issue and fill out the issue template.

@nlaplante Temporary workaround - use startWith as below:-

startWith<string>(null)

Basically remove ambiguity. It would be great if we don;t have to do this though.

Has this been fixed? The part with the 'of' function? It's giving me the worst time when trying to implement it with my ngrx

catchError(error => of({type: ErrorActionTypes.HANDLE_STATUS, payload: {status: error.status}}))

@jtbitt the PR is still open. Should be fixed in the next release I think. Personally I disabled the tslint rule, you can also downgrade RXJS to the previous version.

@evertbouw Thanks

Well, I might sound like a dick here. But ... it's a minor bug, that what fixed immediately after it's been spotted by (at least) hundreds ppl. 2 weeks passes and it's not released. I know, I know. Just a bit frustrating.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Zzzen picture Zzzen  路  3Comments

marcusradell picture marcusradell  路  4Comments

LittleFox94 picture LittleFox94  路  3Comments

benlesh picture benlesh  路  3Comments

chalin picture chalin  路  4Comments