Skip to content

startWith missing an 'empty' signature #3947

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

Closed
cartant opened this issue Jul 24, 2018 · 1 comment
Closed

startWith missing an 'empty' signature #3947

cartant opened this issue Jul 24, 2018 · 1 comment

Comments

@cartant
Copy link
Collaborator

cartant commented Jul 24, 2018

Bug Report

The startWith operator includes a test for its being called with only a scheduler:

it('should start with empty if given value is not specified', () => {
  const e1 =   hot('-a-|');
  const e1subs =   '^  !';
  const expected = '-a-|';

  expectObservable(e1.pipe(startWith(rxTestScheduler))).toBe(expected);
  expectSubscriptions(e1.subscriptions).toBe(e1subs);
});

However there is no associated overload signature:

/* tslint:disable:max-line-length */
export function startWith<T>(v1: T, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T>(v1: T, v2: T, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T>(v1: T, v2: T, v3: T, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T>(v1: T, v2: T, v3: T, v4: T, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T>(v1: T, v2: T, v3: T, v4: T, v5: T, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T>(v1: T, v2: T, v3: T, v4: T, v5: T, v6: T, scheduler?: SchedulerLike): MonoTypeOperatorFunction<T>;
export function startWith<T>(...array: Array<T | SchedulerLike>): MonoTypeOperatorFunction<T>;
/* tslint:enable:max-line-length */

Possible Solution

Add an overload signature that takes only a scheduler.

@cartant cartant changed the title startWith missing an 'empty startWith missing an 'empty' signature Jul 24, 2018
@cartant
Copy link
Collaborator Author

cartant commented Jul 24, 2018

To work around this in PR #3945, the expectation was changed to:

expectObservable(e1.pipe(startWith<any>(rxTestScheduler))).toBe(expected);

When the overload signature is added, the <any> should be removed.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant