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

Conversation

devversion
Copy link
Member

@devversion devversion commented Dec 2, 2018

Fixes a workaround where we cast the MediaQueryList event listener to any because TypeScript didn't have proper types before TS 3.1.

@devversion devversion added the target: patch This PR is targeted for the next patch release label Dec 2, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 2, 2018
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@devversion devversion added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Dec 6, 2018
@mmalerba
Copy link
Contributor

mmalerba commented Jan 4, 2019

I get the following error when trying to presubmit this:

breakpoints-observer.ts:116:7 - error TS2345: Argument of type 'MonoTypeOperatorFunction<MediaQueryList>' is not assignable to parameter of type 'OperatorFunction<MediaQueryListEvent, MediaQueryList>'.
  Types of parameters 'source' and 'source' are incompatible.
    Type 'Observable<MediaQueryListEvent>' is not assignable to type 'Observable<MediaQueryList>'.
      Type 'MediaQueryListEvent' is not assignable to type 'MediaQueryList'.
        Property 'onchange' is missing in type 'MediaQueryListEvent'.

116       startWith(mql),

@devversion
Copy link
Member Author

@mmalerba I will have a look. Let's remove merge ready in the meantime.

@devversion devversion removed the action: merge The PR is ready for merge by the caretaker label Jan 4, 2019
@devversion devversion force-pushed the chore/type-safety-breakpoint-observer branch from 42849cb to 988c756 Compare January 7, 2019 20:44
@devversion
Copy link
Member Author

@mmalerba I think I've fixed that. Could you re-run the presubmit if you find some time? Thanks!

@devversion devversion added the action: merge The PR is ready for merge by the caretaker label Jan 7, 2019
@mmalerba mmalerba added aaa and removed aaa labels Apr 25, 2019
@jelbourn
Copy link
Member

@devversion could you rebase this?

@devversion devversion force-pushed the chore/type-safety-breakpoint-observer branch 2 times, most recently from 639e98c to d2a44a1 Compare May 12, 2019 17:40
@devversion
Copy link
Member Author

@jelbourn Done. I was also able to remove another cast to any since we now use a TypeScript
version that has proper types.

@devversion devversion force-pushed the chore/type-safety-breakpoint-observer branch from d2a44a1 to 5e9bcee Compare May 14, 2019 09:20
@devversion devversion force-pushed the chore/type-safety-breakpoint-observer branch 3 times, most recently from f066809 to 0b0bd6d Compare July 10, 2019 19:32
@mmalerba mmalerba removed the lgtm label Jul 31, 2020
* Fixes a workaround where we cast the MediaQueryList event listener to any because TypeScript didn't have proper types before TS 3.1.
@devversion devversion force-pushed the chore/type-safety-breakpoint-observer branch from 0b0bd6d to 13bbc4f Compare September 11, 2020 09:53
@devversion devversion added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Sep 11, 2020
@andrewseguin andrewseguin removed the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 29, 2021
@andrewseguin andrewseguin merged commit 0f47b7a into angular:master Jan 15, 2022
andrewseguin pushed a commit that referenced this pull request Jan 15, 2022
* Fixes a workaround where we cast the MediaQueryList event listener to any because TypeScript didn't have proper types before TS 3.1.

(cherry picked from commit 0f47b7a)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants