Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bufferTime typings do not accept bufferCreationInterval null #3728

Closed
mattiash opened this issue May 22, 2018 · 1 comment · Fixed by severest/retrobot#221
Closed

bufferTime typings do not accept bufferCreationInterval null #3728

mattiash opened this issue May 22, 2018 · 1 comment · Fixed by severest/retrobot#221
Labels
bug Confirmed bug help wanted Issues we wouldn't mind assistance with. TS Issues and PRs related purely to TypeScript issues

Comments

@mattiash
Copy link
Contributor

RxJS version:
6.1.0

Code to reproduce:

import {from} from 'rxjs'
import {bufferTime} from 'rxjs/operators'

from([1,2,3]).pipe(bufferTime(1000, null, 2)).subscribe(n => console.log(n))

Expected behavior:
Typescript code should compile the code correctly with strictNullChecks.

Actual behavior:

index.ts(4,37): error TS2345: Argument of type 'null' is not assignable to parameter of type 'number'.

Additional information:

The tests for bufferTime in spec/operators/bufferTime-spec.ts test that it works to send in null as bufferCreationInterval (https://github.com/ReactiveX/rxjs/blob/master/spec/operators/bufferTime-spec.ts#L45), but the typings for bufferTime specifies that bufferCreationInterval is a number only. The reason that your tests compile is that you have strictNullChecks set to false in tsconfig.json.

@benlesh
Copy link
Member

benlesh commented May 22, 2018

That's a bug in the typings.

To work around, you can pass any negative number in (I'd recommend -1)

@benlesh benlesh added help wanted Issues we wouldn't mind assistance with. TS Issues and PRs related purely to TypeScript issues Debugging Issue bug Confirmed bug and removed Debugging Issue labels May 22, 2018
mattiash added a commit to mattiash/rxjs that referenced this issue May 23, 2018
The tests for bufferTime verifies that it is possible to set
bufferCreationInterval to null, but the typings did not allow it
when strictNullChecks were set to true.

Fixes ReactiveX#3728
benlesh pushed a commit that referenced this issue May 25, 2018
* fix(typings): allow bufferCreationInterval null for bufferTime

The tests for bufferTime verifies that it is possible to set
bufferCreationInterval to null, but the typings did not allow it
when strictNullChecks were set to true.

Fixes #3728

* fix(typings): allow bufferCreationInterval undefined for bufferTime
@lock lock bot locked as resolved and limited conversation to collaborators Jun 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Confirmed bug help wanted Issues we wouldn't mind assistance with. TS Issues and PRs related purely to TypeScript issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants