diff --git a/spec-dtslint/operators/pluck-spec.ts b/spec-dtslint/operators/pluck-spec.ts index d257f26d9b..a4ef259c09 100644 --- a/spec-dtslint/operators/pluck-spec.ts +++ b/spec-dtslint/operators/pluck-spec.ts @@ -1,4 +1,4 @@ -import { of } from 'rxjs'; +import { of, Observable } from 'rxjs'; import { pluck } from 'rxjs/operators'; it('should infer correctly', () => { @@ -41,6 +41,10 @@ it('should accept string only', () => { const a = of({ name: 'abc' }).pipe(pluck(1)); // $ExpectError }); +it('should not infer type from the variable if key doesn\'t exist', () => { + const a: Observable = of({ name: 'abc' }).pipe(pluck('xyz')); // $ExpectError +}); + it('should accept a spread of arguments', () => { const obj = { foo: { diff --git a/src/internal/operators/pluck.ts b/src/internal/operators/pluck.ts index 2cb5fb0b51..eef435184f 100644 --- a/src/internal/operators/pluck.ts +++ b/src/internal/operators/pluck.ts @@ -9,8 +9,8 @@ export function pluck(k1: K1, k2: K2, k3: K3, k4: K4): OperatorFunction; export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction; export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction; -export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction; -export function pluck(...properties: string[]): OperatorFunction; +export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction; +export function pluck(...properties: string[]): OperatorFunction; /* tslint:enable:max-line-length */ /**