Skip to content

Commit a90594c

Browse files
author
Jonathan Meier
committed
refactor(multiple): explicitly type untyped RxJS Subject instances
Add explicit type arguments to untyped `new Subject()` instances whose `.next()` method is called with no arguments. In RxJS 7, `Subject.next(value: T)` requires an argument unless `T` is `void` (or includes `void`), so calling `.next()` with no arguments on an untyped `Subject<unknown>` fails to type-check. Typing these subjects explicitly fixes RxJS 7 compatibility without changing runtime behavior.
1 parent df58663 commit a90594c

5 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎goldens/material/sidenav/index.api.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export const MAT_DRAWER_DEFAULT_AUTOSIZE: InjectionToken<boolean>;
2828
// @public
2929
export class MatDrawer implements AfterViewInit, OnDestroy {
3030
constructor();
31-
readonly _animationEnd: Subject<unknown>;
32-
readonly _animationStarted: Subject<unknown>;
31+
readonly _animationEnd: Subject<void | TransitionEvent>;
32+
readonly _animationStarted: Subject<void>;
3333
get autoFocus(): AutoFocusTarget | string | boolean;
3434
set autoFocus(value: AutoFocusTarget | string | BooleanInput);
3535
close(): Promise<MatDrawerToggleResult>;

‎src/cdk-experimental/popover-edit/table-directives.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ export class CdkEditable implements AfterViewInit, OnDestroy {
104104

105105
protected readonly destroyed = new Subject<void>();
106106

107-
private _rowsRendered = new Subject();
107+
private _rowsRendered = new Subject<void>();
108108

109109
private _rowMutationObserver = globalThis.MutationObserver
110110
? new globalThis.MutationObserver(mutations => {

‎src/material/autocomplete/autocomplete-trigger.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export class MatAutocompleteTrigger
143143
private _overlayRef: OverlayRef | null = null;
144144
private _portal!: TemplatePortal;
145145
private _componentDestroyed = false;
146-
private _initialized = new Subject();
146+
private _initialized = new Subject<void>();
147147
private _keydownSubscription: Subscription | undefined;
148148
private _outsideClickSubscription: Subscription | undefined;
149149
private _cleanupWindowBlur: (() => void) | undefined;

‎src/material/select/select.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ export class MatSelect
205205
protected _defaultOptions = inject(MAT_SELECT_CONFIG, {optional: true});
206206
protected _animationsDisabled = _animationsDisabled();
207207
protected _popoverLocation: FlexibleOverlayPopoverLocation | null;
208-
private _initialized = new Subject();
208+
private _initialized = new Subject<void>();
209209
private _cleanupDetach: (() => void) | undefined;
210210

211211
/** All of the defined select options. */

‎src/material/sidenav/drawer.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,10 +302,10 @@ export class MatDrawer implements AfterViewInit, OnDestroy {
302302
private _openedVia: FocusOrigin | null = null;
303303

304304
/** Emits whenever the drawer has started animating. */
305-
readonly _animationStarted = new Subject();
305+
readonly _animationStarted = new Subject<void>();
306306

307307
/** Emits whenever the drawer is done animating. */
308-
readonly _animationEnd = new Subject();
308+
readonly _animationEnd = new Subject<TransitionEvent | void>();
309309

310310
/** Event emitted when the drawer open state is changed. */
311311
@Output() readonly openedChange: EventEmitter<boolean> =

0 commit comments

Comments
 (0)