Skip to content

bufferTime typings do not accept bufferCreationInterval null #3728

@mattiash

Description

@mattiash
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.

Activity

benlesh

benlesh commented on May 22, 2018

@benlesh
Member

That's a bug in the typings.

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

added
help wantedIssues we wouldn't mind assistance with.
TSIssues and PRs related purely to TypeScript issues
bugConfirmed bug
and removed on May 22, 2018
added a commit that references this issue on May 23, 2018
0f4dafc
added a commit that references this issue on May 25, 2018
0bda9cd
locked as resolved and limited conversation to collaborators on Jun 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TSIssues and PRs related purely to TypeScript issuesbugConfirmed bughelp wantedIssues we wouldn't mind assistance with.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @mattiash@benlesh

      Issue actions

        bufferTime typings do not accept bufferCreationInterval null · Issue #3728 · ReactiveX/rxjs