-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
severest/retrobot
#221Labels
TSIssues and PRs related purely to TypeScript issuesIssues and PRs related purely to TypeScript issuesbugConfirmed bugConfirmed bughelp wantedIssues we wouldn't mind assistance with.Issues we wouldn't mind assistance with.
Description
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.
Metadata
Metadata
Assignees
Labels
TSIssues and PRs related purely to TypeScript issuesIssues and PRs related purely to TypeScript issuesbugConfirmed bugConfirmed bughelp wantedIssues we wouldn't mind assistance with.Issues we wouldn't mind assistance with.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
benlesh commentedon May 22, 2018
That's a bug in the typings.
To work around, you can pass any negative number in (I'd recommend
-1
)fix(typings): allow bufferCreationInterval null for bufferTime
fix(typings): allow bufferCreationInterval null for bufferTime (#3734)