Skip to content

Commit aa9c3d4

Browse files
authored
chore: deprecate thisArg signatures (#6361)
* chore: deprecate thisArg * chore: deprecate source parameters Closes #6143 * Revert "chore: deprecate source parameters" This reverts commit 8bb2f84. Closes #6143. * chore: update api_guardian
1 parent 2271a91 commit aa9c3d4

File tree

7 files changed

+19
-4
lines changed

7 files changed

+19
-4
lines changed

api_guard/dist/types/operators/index.d.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export declare function endWith<T>(scheduler: SchedulerLike): MonoTypeOperatorFu
7676
export declare function endWith<T, A extends unknown[] = T[]>(...valuesAndScheduler: [...A, SchedulerLike]): OperatorFunction<T, T | ValueFromArray<A>>;
7777
export declare function endWith<T, A extends unknown[] = T[]>(...values: A): OperatorFunction<T, T | ValueFromArray<A>>;
7878

79-
export declare function every<T>(predicate: BooleanConstructor, thisArg?: any): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;
79+
export declare function every<T>(predicate: BooleanConstructor): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;
80+
export declare function every<T>(predicate: BooleanConstructor, thisArg: any): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;
8081
export declare function every<T, A>(predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean, thisArg: A): OperatorFunction<T, boolean>;
8182
export declare function every<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, boolean>;
8283

@@ -105,7 +106,8 @@ export declare function find<T, S extends T>(predicate: (value: T, index: number
105106
export declare function find<T, A>(predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean, thisArg: A): OperatorFunction<T, T | undefined>;
106107
export declare function find<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, T | undefined>;
107108

108-
export declare function findIndex<T>(predicate: BooleanConstructor, thisArg?: any): OperatorFunction<T, T extends Falsy ? -1 : number>;
109+
export declare function findIndex<T>(predicate: BooleanConstructor): OperatorFunction<T, T extends Falsy ? -1 : number>;
110+
export declare function findIndex<T>(predicate: BooleanConstructor, thisArg: any): OperatorFunction<T, T extends Falsy ? -1 : number>;
109111
export declare function findIndex<T, A>(predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean, thisArg: A): OperatorFunction<T, number>;
110112
export declare function findIndex<T>(predicate: (value: T, index: number, source: Observable<T>) => boolean): OperatorFunction<T, number>;
111113

src/internal/observable/partition.ts

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ObservableInput } from '../types';
44
import { Observable } from '../Observable';
55
import { innerFrom } from './from';
66

7+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
78
export function partition<T, U extends T, A>(
89
source: ObservableInput<T>,
910
predicate: (this: A, value: T, index: number) => value is U,
@@ -14,6 +15,7 @@ export function partition<T, U extends T>(
1415
predicate: (value: T, index: number) => value is U
1516
): [Observable<U>, Observable<Exclude<T, U>>];
1617

18+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
1719
export function partition<T, A>(
1820
source: ObservableInput<T>,
1921
predicate: (this: A, value: T, index: number) => boolean,

src/internal/operators/every.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ import { Falsy, OperatorFunction } from '../types';
33
import { operate } from '../util/lift';
44
import { OperatorSubscriber } from './OperatorSubscriber';
55

6+
export function every<T>(predicate: BooleanConstructor): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;
7+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
68
export function every<T>(
79
predicate: BooleanConstructor,
8-
thisArg?: any
10+
thisArg: any
911
): OperatorFunction<T, Exclude<T, Falsy> extends never ? false : boolean>;
12+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
1013
export function every<T, A>(
1114
predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,
1215
thisArg: A

src/internal/operators/filter.ts

+2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@ import { OperatorFunction, MonoTypeOperatorFunction, TruthyTypesOf } from '../ty
22
import { operate } from '../util/lift';
33
import { OperatorSubscriber } from './OperatorSubscriber';
44

5+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
56
export function filter<T, S extends T, A>(predicate: (this: A, value: T, index: number) => value is S, thisArg: A): OperatorFunction<T, S>;
67
export function filter<T, S extends T>(predicate: (value: T, index: number) => value is S): OperatorFunction<T, S>;
78
export function filter<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
9+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
810
export function filter<T, A>(predicate: (this: A, value: T, index: number) => boolean, thisArg: A): MonoTypeOperatorFunction<T>;
911
export function filter<T>(predicate: (value: T, index: number) => boolean): MonoTypeOperatorFunction<T>;
1012

src/internal/operators/find.ts

+2
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@ import { operate } from '../util/lift';
55
import { OperatorSubscriber } from './OperatorSubscriber';
66

77
export function find<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
8+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
89
export function find<T, S extends T, A>(
910
predicate: (this: A, value: T, index: number, source: Observable<T>) => value is S,
1011
thisArg: A
1112
): OperatorFunction<T, S | undefined>;
1213
export function find<T, S extends T>(
1314
predicate: (value: T, index: number, source: Observable<T>) => value is S
1415
): OperatorFunction<T, S | undefined>;
16+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
1517
export function find<T, A>(
1618
predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,
1719
thisArg: A

src/internal/operators/findIndex.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ import { Falsy, OperatorFunction } from '../types';
33
import { operate } from '../util/lift';
44
import { createFind } from './find';
55

6-
export function findIndex<T>(predicate: BooleanConstructor, thisArg?: any): OperatorFunction<T, T extends Falsy ? -1 : number>;
6+
export function findIndex<T>(predicate: BooleanConstructor): OperatorFunction<T, T extends Falsy ? -1 : number>;
7+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
8+
export function findIndex<T>(predicate: BooleanConstructor, thisArg: any): OperatorFunction<T, T extends Falsy ? -1 : number>;
9+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
710
export function findIndex<T, A>(
811
predicate: (this: A, value: T, index: number, source: Observable<T>) => boolean,
912
thisArg: A

src/internal/operators/map.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { operate } from '../util/lift';
33
import { OperatorSubscriber } from './OperatorSubscriber';
44

55
export function map<T, R>(project: (value: T, index: number) => R): OperatorFunction<T, R>;
6+
/** @deprecated Use a closure instead of a `thisArg`. Signatures accepting a `thisArg` will be removed in v8. */
67
export function map<T, R, A>(project: (this: A, value: T, index: number) => R, thisArg: A): OperatorFunction<T, R>;
78

89
/**

0 commit comments

Comments
 (0)