Skip to content

feat(core): add ModuleWithProviders generic type migration #33217

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

Closed
wants to merge 6 commits into from

Conversation

CaerusKaru
Copy link
Member

@CaerusKaru CaerusKaru commented Oct 17, 2019

Static methods that return a type of ModuleWithProviders currently do not have to specify a type because the generic falls back to any. This is problematic because the type of the actual module being returned is not present in the type information.

Since Ivy uses d.ts files exclusively for downstream packages (rather than metadata.json files, for example), we no longer have the type of the actual module being created.

For this reason, a generic type should be added for ModuleWithProviders that specifies the module type. This will be required for all users in v10, but will only be necessary for users of Ivy in v9.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

ModuleWithProviders requires an explicit generic type

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@CaerusKaru CaerusKaru force-pushed the adam/mwp branch 3 times, most recently from 4f96a13 to 5d38a20 Compare October 17, 2019 17:10
@CaerusKaru CaerusKaru marked this pull request as ready for review October 17, 2019 17:10
@CaerusKaru CaerusKaru requested review from a team as code owners October 17, 2019 17:11
@CaerusKaru
Copy link
Member Author

@vikerman vikerman requested review from devversion and kara October 17, 2019 18:43
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

Thanks for doing this! Initial thoughts below

@CaerusKaru CaerusKaru changed the title feat(core): remove fallback for ModuleWithProviders generic type feat(core): add ModuleWithProviders generic type migration Oct 17, 2019
@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@matsko matsko added the area: core Issues related to the framework runtime label Oct 17, 2019
@ngbot ngbot bot added this to the needsTriage milestone Oct 17, 2019
Static methods that return a type of ModuleWithProviders currently
do not have to specify a type because the generic falls back to any.
This is problematic because the type of the actual module being
returned is not present in the type information.

Since Ivy uses d.ts files exclusively for downstream packages
(rather than metadata.json files, for example), we no longer have
the type of the actual module being created.

For this reason, a generic type should be added for
ModuleWithProviders that specifies the module type. This will be
required for all users in v10, but will only be necessary for
users of Ivy in v9.
@CaerusKaru CaerusKaru force-pushed the adam/mwp branch 2 times, most recently from c41ee14 to 66ad830 Compare October 18, 2019 21:27
@CaerusKaru CaerusKaru requested review from kara and devversion October 18, 2019 22:21
Copy link
Member

@devversion devversion left a comment

Choose a reason for hiding this comment

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

Nice work 💯 Just a few minor comments.

Also, the test cases look all very reasonable to me, so I think the migration covers most of the cases.

@CaerusKaru CaerusKaru force-pushed the adam/mwp branch 2 times, most recently from 9813cf9 to e3822ad Compare October 20, 2019 17:59
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM aside from a few minor nits below

@kara kara added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Oct 20, 2019
@kara kara added the target: major This PR is targeted for the next major release label Oct 20, 2019
Copy link
Member

@devversion devversion 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 assigned kara and unassigned CaerusKaru Oct 21, 2019
Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

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

LGTM

@kara kara removed their assignment Oct 21, 2019
@kara kara added action: presubmit The PR is in need of a google3 presubmit and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Oct 21, 2019
@kara
Copy link
Contributor

kara commented Oct 21, 2019

VE presubmit

@kara
Copy link
Contributor

kara commented Oct 21, 2019

Caretaker note: needs g3 patch (CL here)

@kara kara added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit labels Oct 21, 2019
@matsko matsko closed this in 56731f6 Oct 21, 2019
@CaerusKaru CaerusKaru deleted the adam/mwp branch October 21, 2019 20:54
AndrusGerman pushed a commit to AndrusGerman/angular that referenced this pull request Oct 22, 2019
…3217)

Static methods that return a type of ModuleWithProviders currently
do not have to specify a type because the generic falls back to any.
This is problematic because the type of the actual module being
returned is not present in the type information.

Since Ivy uses d.ts files exclusively for downstream packages
(rather than metadata.json files, for example), we no longer have
the type of the actual module being created.

For this reason, a generic type should be added for
ModuleWithProviders that specifies the module type. This will be
required for all users in v10, but will only be necessary for
users of Ivy in v9.

PR Close angular#33217
@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 Nov 21, 2019
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 area: core Issues related to the framework runtime cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants