Skip to content

Commit 548c72c

Browse files
fix(component): remove class-level generic from PushPipe (#3127)
Closes #3114 BREAKING CHANGES: PushPipe no longer has a class-level generic type parameter. BEFORE: Use of PushPipe outside of component templates required a generic AFTER: Use of PushPipe outside of component templates no longer requires a generic
1 parent 5ed3c3d commit 548c72c

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

modules/component/spec/push/push.pipe.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { EMPTY, NEVER, Observable, ObservableInput, of } from 'rxjs';
1111
import { PushPipe } from '../../src/push/push.pipe';
1212
import { MockChangeDetectorRef } from '../fixtures/fixtures';
1313

14-
let pushPipe: PushPipe<unknown>;
14+
let pushPipe: PushPipe;
1515

1616
function wrapWithSpace(str: string): string {
1717
return ' ' + str + ' ';

modules/component/src/push/push.pipe.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,26 +54,24 @@ import { createRender } from '../core/cd-aware/creator_render';
5454
* @publicApi
5555
*/
5656
@Pipe({ name: 'ngrxPush', pure: false })
57-
export class PushPipe<S> implements PipeTransform, OnDestroy {
58-
private renderedValue: S | null | undefined;
57+
export class PushPipe implements PipeTransform, OnDestroy {
58+
private renderedValue: unknown;
5959

6060
private readonly subscription: Unsubscribable;
61-
private readonly cdAware: CdAware<S | null | undefined>;
61+
private readonly cdAware: CdAware<unknown>;
6262
private readonly resetContextObserver: NextObserver<void> = {
6363
next: () => (this.renderedValue = undefined),
6464
};
65-
private readonly updateViewContextObserver: NextObserver<
66-
S | null | undefined
67-
> = {
68-
next: (value: S | null | undefined) => (this.renderedValue = value),
65+
private readonly updateViewContextObserver: NextObserver<unknown> = {
66+
next: (value) => (this.renderedValue = value),
6967
};
7068

7169
constructor(
7270
cdRef: ChangeDetectorRef,
7371
ngZone: NgZone,
7472
errorHandler: ErrorHandler
7573
) {
76-
this.cdAware = createCdAware<S>({
74+
this.cdAware = createCdAware({
7775
render: createRender({ cdRef, ngZone }),
7876
updateViewContextObserver: this.updateViewContextObserver,
7977
resetContextObserver: this.resetContextObserver,
@@ -89,7 +87,7 @@ export class PushPipe<S> implements PipeTransform, OnDestroy {
8987
potentialObservable: ObservableInput<T> | null | undefined
9088
): T | null | undefined {
9189
this.cdAware.nextPotentialObservable(potentialObservable);
92-
return this.renderedValue as any;
90+
return this.renderedValue as T | null | undefined;
9391
}
9492

9593
ngOnDestroy(): void {

0 commit comments

Comments
 (0)