Skip to content

chore: improve type safety in breakpoint observer #14356

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

Merged
Merged
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
4 changes: 2 additions & 2 deletions src/cdk/layout/breakpoints-observer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ export class BreakpointObserver implements OnDestroy {
const mql = this._mediaMatcher.matchMedia(query);

// Create callback for match changes and add it is as a listener.
const queryObservable = new Observable((observer: Observer<MediaQueryList>) => {
const queryObservable = new Observable((observer: Observer<MediaQueryListEvent>) => {
// Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed
// back into the zone because matchMedia is only included in Zone.js by loading the
// webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not
// have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js
// patches it.
const handler = (e: any) => this._zone.run(() => observer.next(e));
const handler = (e: MediaQueryListEvent): void => this._zone.run(() => observer.next(e));
mql.addListener(handler);

return () => {
Expand Down