From d14d8b3a196dd94575f1467b3969b745911517f0 Mon Sep 17 00:00:00 2001 From: markostanimirovic Date: Fri, 27 Aug 2021 17:32:41 +0200 Subject: [PATCH] fix(component): remove class-level generic from PushPipe BREAKING CHANGE: PushPipe no longer has a class-level generic type parameter. This change will affect the use of PushPipe outside of component templates. --- modules/component/spec/push/push.pipe.spec.ts | 2 +- modules/component/src/push/push.pipe.ts | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/modules/component/spec/push/push.pipe.spec.ts b/modules/component/spec/push/push.pipe.spec.ts index 7284cac4f8..5f9a1b4950 100644 --- a/modules/component/spec/push/push.pipe.spec.ts +++ b/modules/component/spec/push/push.pipe.spec.ts @@ -11,7 +11,7 @@ import { EMPTY, NEVER, Observable, ObservableInput, of } from 'rxjs'; import { PushPipe } from '../../src/push/push.pipe'; import { MockChangeDetectorRef } from '../fixtures/fixtures'; -let pushPipe: PushPipe; +let pushPipe: PushPipe; function wrapWithSpace(str: string): string { return ' ' + str + ' '; diff --git a/modules/component/src/push/push.pipe.ts b/modules/component/src/push/push.pipe.ts index 75910504a1..de08daed05 100644 --- a/modules/component/src/push/push.pipe.ts +++ b/modules/component/src/push/push.pipe.ts @@ -54,18 +54,16 @@ import { createRender } from '../core/cd-aware/creator_render'; * @publicApi */ @Pipe({ name: 'ngrxPush', pure: false }) -export class PushPipe implements PipeTransform, OnDestroy { - private renderedValue: S | null | undefined; +export class PushPipe implements PipeTransform, OnDestroy { + private renderedValue: unknown; private readonly subscription: Unsubscribable; - private readonly cdAware: CdAware; + private readonly cdAware: CdAware; private readonly resetContextObserver: NextObserver = { next: () => (this.renderedValue = undefined), }; - private readonly updateViewContextObserver: NextObserver< - S | null | undefined - > = { - next: (value: S | null | undefined) => (this.renderedValue = value), + private readonly updateViewContextObserver: NextObserver = { + next: (value) => (this.renderedValue = value), }; constructor( @@ -73,7 +71,7 @@ export class PushPipe implements PipeTransform, OnDestroy { ngZone: NgZone, errorHandler: ErrorHandler ) { - this.cdAware = createCdAware({ + this.cdAware = createCdAware({ render: createRender({ cdRef, ngZone }), updateViewContextObserver: this.updateViewContextObserver, resetContextObserver: this.resetContextObserver, @@ -89,7 +87,7 @@ export class PushPipe implements PipeTransform, OnDestroy { potentialObservable: ObservableInput | null | undefined ): T | null | undefined { this.cdAware.nextPotentialObservable(potentialObservable); - return this.renderedValue as any; + return this.renderedValue as T | null | undefined; } ngOnDestroy(): void {