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

fix(component): remove class-level generic from PushPipe #3127

Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion modules/component/spec/push/push.pipe.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>;
let pushPipe: PushPipe;

function wrapWithSpace(str: string): string {
return ' ' + str + ' ';
Expand Down
16 changes: 7 additions & 9 deletions modules/component/src/push/push.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,26 +54,24 @@ import { createRender } from '../core/cd-aware/creator_render';
* @publicApi
*/
@Pipe({ name: 'ngrxPush', pure: false })
export class PushPipe<S> 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<S | null | undefined>;
private readonly cdAware: CdAware<unknown>;
private readonly resetContextObserver: NextObserver<void> = {
next: () => (this.renderedValue = undefined),
};
private readonly updateViewContextObserver: NextObserver<
S | null | undefined
> = {
next: (value: S | null | undefined) => (this.renderedValue = value),
private readonly updateViewContextObserver: NextObserver<unknown> = {
next: (value) => (this.renderedValue = value),
};

constructor(
cdRef: ChangeDetectorRef,
ngZone: NgZone,
errorHandler: ErrorHandler
) {
this.cdAware = createCdAware<S>({
this.cdAware = createCdAware({
render: createRender({ cdRef, ngZone }),
updateViewContextObserver: this.updateViewContextObserver,
resetContextObserver: this.resetContextObserver,
Expand All @@ -89,7 +87,7 @@ export class PushPipe<S> implements PipeTransform, OnDestroy {
potentialObservable: ObservableInput<T> | null | undefined
): T | null | undefined {
this.cdAware.nextPotentialObservable(potentialObservable);
return this.renderedValue as any;
return this.renderedValue as T | null | undefined;
}

ngOnDestroy(): void {
Expand Down