Skip to content
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

Update filter.ts #5937

Merged
merged 5 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions spec-dtslint/operators/filter-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ it('should support Boolean as a predicate', () => {
const x = of(false, false, false, false).pipe(filter(Boolean)); // $ExpectType Observable<true>
});

it('should narrow on always-false predicates', () => {
const o = of(1, 2, 3).pipe(filter(() => false)); // $ExpectType Observable<never>
});

// I've not been able to effect a failing dtslint test for this situation and a
// conventional test won't fail because the TypeScript configuration isn't
// sufficiently strict:
Expand Down
1 change: 0 additions & 1 deletion src/internal/operators/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { OperatorFunction, MonoTypeOperatorFunction, TruthyTypesOf } from '../ty
import { operate } from '../util/lift';
import { OperatorSubscriber } from './OperatorSubscriber';

export function filter<T>(predicate: (value: T, index: number) => false, thisArg?: any): OperatorFunction<T, never>;
export function filter<T, S extends T>(predicate: (value: T, index: number) => value is S, thisArg?: any): OperatorFunction<T, S>;
export function filter<T>(predicate: BooleanConstructor): OperatorFunction<T, TruthyTypesOf<T>>;
export function filter<T>(predicate: (value: T, index: number) => boolean, thisArg?: any): MonoTypeOperatorFunction<T>;
Expand Down