Skip to content

Commit

Permalink
fix: remove leftover params from breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
43081j committed Jan 23, 2024
1 parent 5af28f7 commit 961d98b
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 69 deletions.
15 changes: 0 additions & 15 deletions packages/rxjs/spec-dtslint/operators/every-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,3 @@ it('should handle the Boolean constructor', () => {
const d = of(NaN, NaN, NaN).pipe(every(Boolean)); // $ExpectType Observable<boolean>
const e = of(0, 1, 0).pipe(every(Boolean)); // $ExpectType Observable<boolean>
})

it('should support this', () => {
const thisArg = { limit: 5 };
const a = of(1, 2, 3).pipe(every(function (val) {
const limit = this.limit; // $ExpectType number
return val < limit;
}, thisArg));
});

it('should deprecate thisArg usage', () => {
const a = of(1, 2, 3).pipe(every(Boolean)); // $ExpectNoDeprecation
const b = of(1, 2, 3).pipe(every(Boolean, {})); // $ExpectDeprecation
const c = of(1, 2, 3).pipe(every((value) => Boolean(value))); // $ExpectNoDeprecation
const d = of(1, 2, 3).pipe(every((value) => Boolean(value), {})); // $ExpectDeprecation
});
98 changes: 47 additions & 51 deletions packages/rxjs/spec-dtslint/operators/expand-spec.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,47 @@
import { of, asyncScheduler } from 'rxjs';
import { expand } from 'rxjs/operators';

it('should infer correctly', () => {
const o = of(1, 2, 3).pipe(expand(value => of(value))); // $ExpectType Observable<number>
const p = of(1, 2, 3).pipe(expand(value => [value])); // $ExpectType Observable<number>
const q = of(1, 2, 3).pipe(expand(value => Promise.resolve(value))); // $ExpectType Observable<number>
});

it('should infer correctly with a different type as the source', () => {
const o = of(1, 2, 3).pipe(expand(value => of('foo'))); // $ExpectType Observable<string>
const p = of(1, 2, 3).pipe(expand(value => ['foo'])); // $ExpectType Observable<string>
const q = of(1, 2, 3).pipe(expand(value => Promise.resolve('foo'))); // $ExpectType Observable<string>
});

it('should support a project function with index', () => {
const o = of(1, 2, 3).pipe(expand((value, index) => of(index))); // $ExpectType Observable<number>
});

it('should support concurrent parameter', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 47)); // $ExpectType Observable<number>
});

it('should support a scheduler', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 47, asyncScheduler)); // $ExpectType Observable<number>
});

it('should enforce types', () => {
const o = of(1, 2, 3).pipe(expand()); // $ExpectError
});

it('should enforce project types', () => {
const o = of(1, 2, 3).pipe(expand((value: string, index) => of(1))); // $ExpectError
const p = of(1, 2, 3).pipe(expand((value, index: string) => of(1))); // $ExpectError
});

it('should enforce project return type', () => {
const o = of(1, 2, 3).pipe(expand(value => 1)); // $ExpectError
});

it('should enforce concurrent type', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 'foo')); // $ExpectError
});

it('should enforce scheduler type', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 47, 'foo')); // $ExpectError
});

it('should support union types', () => {
const o = of(1).pipe(expand(x => typeof x === 'string' ? of(123) : of('test'))); // $ExpectType Observable<string | number>
});
import { of, asyncScheduler } from 'rxjs';
import { expand } from 'rxjs/operators';

it('should infer correctly', () => {
const o = of(1, 2, 3).pipe(expand(value => of(value))); // $ExpectType Observable<number>
const p = of(1, 2, 3).pipe(expand(value => [value])); // $ExpectType Observable<number>
const q = of(1, 2, 3).pipe(expand(value => Promise.resolve(value))); // $ExpectType Observable<number>
});

it('should infer correctly with a different type as the source', () => {
const o = of(1, 2, 3).pipe(expand(value => of('foo'))); // $ExpectType Observable<string>
const p = of(1, 2, 3).pipe(expand(value => ['foo'])); // $ExpectType Observable<string>
const q = of(1, 2, 3).pipe(expand(value => Promise.resolve('foo'))); // $ExpectType Observable<string>
});

it('should support a project function with index', () => {
const o = of(1, 2, 3).pipe(expand((value, index) => of(index))); // $ExpectType Observable<number>
});

it('should support concurrent parameter', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 47)); // $ExpectType Observable<number>
});

it('should enforce types', () => {
const o = of(1, 2, 3).pipe(expand()); // $ExpectError
});

it('should enforce project types', () => {
const o = of(1, 2, 3).pipe(expand((value: string, index) => of(1))); // $ExpectError
const p = of(1, 2, 3).pipe(expand((value, index: string) => of(1))); // $ExpectError
});

it('should enforce project return type', () => {
const o = of(1, 2, 3).pipe(expand(value => 1)); // $ExpectError
});

it('should enforce concurrent type', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 'foo')); // $ExpectError
});

it('should enforce scheduler type', () => {
const o = of(1, 2, 3).pipe(expand(value => of(1), 47, 'foo')); // $ExpectError
});

it('should support union types', () => {
const o = of(1).pipe(expand(x => typeof x === 'string' ? of(123) : of('test'))); // $ExpectType Observable<string | number>
});
1 change: 0 additions & 1 deletion packages/rxjs/src/internal/operators/every.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export function every<T>(predicate: (value: T, index: number) => boolean): Opera
* ```
*
* @param predicate A function for determining if an item meets a specified condition.
* @param thisArg Optional object to use for `this` in the callback.
* @return A function that returns an Observable of booleans that determines if
* all items of the source Observable meet the condition specified.
*/
Expand Down
2 changes: 0 additions & 2 deletions packages/rxjs/src/internal/operators/expand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ export function expand<T, O extends ObservableInput<unknown>>(
* or the output Observable, returns an Observable.
* @param concurrent Maximum number of input Observables being subscribed to
* concurrently.
* @param scheduler The {@link SchedulerLike} to use for subscribing to
* each projected inner Observable.
* @return A function that returns an Observable that emits the source values
* and also result of applying the projection function to each value emitted on
* the output Observable and merging the results of the Observables obtained
Expand Down

0 comments on commit 961d98b

Please sign in to comment.