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

refactor: enable Ivy and fix template type checking issues #17392

Merged
merged 1 commit into from Oct 22, 2019

Conversation

Splaktar
Copy link
Member

@Splaktar Splaktar commented Oct 14, 2019

Changes

  • enable Ivy and fix template type checking in Bazel
    • for libraries, examples, dev-app, CI
    • add postinstall task for ivy-ngcc and configure it for our SystemJS setup
  • pin to Angular 9.0.0-next.10 for this PR
    • Angular 9.0.0-next.11 brings in a lot of new template type checking errors
  • fix buggy show bounding box checkbox in connected-overlay-demo
  • fix stylelint to work with WebStorm plugin
  • restrict NodeJS version to 10.x
    • We can't go to NodeJS 12.x without dropping or upgrading Gulp to 4.x

API Changes

  • export ProgressBarMode type from mdc-progress-bar and mat-progress-bar
  • export MatDrawerMode type from mat-drawer
  • Add | null to mat-tab-body's @Input() origin: number;

TODO

Notes

  • Settting "fullTemplateTypeCheck": false for dev-app doesn't remove the need for many of the changes in this PR. false here means, do partial template type checking. It doesn't turn off template type checking.
    • Similarly "fullTemplateTypeCheck": false does not resolve the hundreds of errors from Angular 9.0.0-next.11.

Other related issues

Fixes #16606. Closes #16373.

@Splaktar Splaktar added in progress This issue is currently in progress refactoring This issue is related to a refactoring labels Oct 14, 2019
@Splaktar Splaktar self-assigned this Oct 14, 2019
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 14, 2019
@Splaktar Splaktar force-pushed the devApp-enableIvy branch 4 times, most recently from 96a2981 to a2c0f5c Compare October 15, 2019 19:12
@Splaktar Splaktar force-pushed the devApp-enableIvy branch 4 times, most recently from 3cba263 to 2adff8a Compare October 16, 2019 00:46
@Splaktar
Copy link
Member Author

Splaktar commented Oct 16, 2019

It looks like the issue with the page not loading due to moduleDef undefined errors, may be related to this

 --create-ivy-entry-points  If specified then new `*_ivy_ngcc` entry-points
                             will be added to package.json rather than modifying
                             the ones in-place.
                             For this to work you need to have custom resolution
                             set up (e.g. in webpack) to look for these new
                             entry-points.
                             The Angular CLI does this already, so it is safe to
                             use this option if the project is being built via
                             the CLI.                

We haven't set up any custom resolution in our SystemJS configuration AFAIK.

Update: Yep, removing this --create-ivy-entry-points option and using only main as a property fixed this issue.

package.json Outdated Show resolved Hide resolved
@Splaktar Splaktar force-pushed the devApp-enableIvy branch 5 times, most recently from 32fe812 to e580a12 Compare October 17, 2019 18:09
@Splaktar Splaktar marked this pull request as ready for review October 17, 2019 18:41
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

All the changes in here too good overall. The Angular version thing will conflict w/ my TypeScript 3.6 update when that's ready, since I'll need a higher version of Angular. I think we'll be able to move forward with fullTemplateTypeCheck = false for the time being.

.bazelrc Outdated
# does not generate factory files which are needed for AOT.
build --define=compile=legacy
# Use the Ivy AOT compiler strategy. We want to compile with Ivy and with "ngtsc".
build --define=compile=aot --keep_going=true
Copy link
Member

Choose a reason for hiding this comment

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

What are the required steps if someone wants to test something in ViewEngine?

Copy link
Member Author

Choose a reason for hiding this comment

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

To build for ViewEngine, you can use --define=compile=legacy here instead. I think that @devversion has some ideas on how to make this more configurable and hopefully add NPM scripts to the package.json for building with Ivy (default) or ViewEngine.

I think that the deploy scripts will need to be changed to always build with ViewEngine since, in Angular version 9, that's the only way to publish libraries.

package.json Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/a11y-demo/checkbox/checkbox-a11y.ts Outdated Show resolved Hide resolved
src/dev-app/datepicker/datepicker-demo.ts Show resolved Hide resolved
src/material/tabs/tab-group.html Outdated Show resolved Hide resolved
.bazelrc Outdated Show resolved Hide resolved
.bazelrc Outdated Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
"yarn": ">= 1.17.3"
},
"scripts": {
"postinstall": "node --preserve-symlinks --preserve-symlinks-main tools/bazel/postinstall-patches.js",
"postinstall": "node --preserve-symlinks --preserve-symlinks-main tools/bazel/postinstall-patches.js | ivy-ngcc --properties main",
Copy link
Member

Choose a reason for hiding this comment

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

It might be good to only do this when running within Bazel. ngcc is not very fast and otherwise we are running ngcc twice. We can tackle this in a follow-up though.

src/dev-app/checkbox/checkbox-demo.ts Show resolved Hide resolved
e.g. [value] is set for MatInput and MatDatepicker.
MatInput#value expects a string whereas MatDatepicker#value expects a Date.
This breaks strict template type checking. What should we do here?
-->
Copy link
Member

Choose a reason for hiding this comment

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

Re-opening a comment here again (we had one in the other PR for this). I'm not sure if anything has changed here. Not even sure if we have a ticket for it. I don't think we talked about it in the framework meeting yet.

Copy link
Member Author

Choose a reason for hiding this comment

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

Jeremy spoke to Alex R about it. It sounds like this is a real issue and that Alex was going to investigate a fix. We should probably open a ticket in JIRA?

@Splaktar Splaktar added this to the 9.0.0 milestone Oct 18, 2019
@Splaktar Splaktar added the P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful label Oct 18, 2019
@Splaktar Splaktar force-pushed the devApp-enableIvy branch 2 times, most recently from a9d7cf3 to a4546e5 Compare October 18, 2019 05:35
@Splaktar
Copy link
Member Author

I've got a WIP PR open that contains these changes plus 731b80d which starts to resolve all of the next.11 template type checking errors with "fullTemplateTypeCheck": true,.

@Splaktar Splaktar force-pushed the devApp-enableIvy branch 2 times, most recently from 54a3373 to 551e3f0 Compare October 21, 2019 17:53
@Splaktar
Copy link
Member Author

Splaktar commented Oct 21, 2019

It looks like @angular/schematics@9.0.0-next.12 requires TypeScript 3.6. I'm reverting the version of the Angular CLI related libraries to resolve this.

@Splaktar Splaktar force-pushed the devApp-enableIvy branch 3 times, most recently from 03b0db8 to 8d123fd Compare October 21, 2019 18:49
@Splaktar
Copy link
Member Author

I had to revert Angular 9.0.0-next.11 as well as it runs into strange issues with ivy_test failing due to npm or yarn errors.

@Splaktar Splaktar force-pushed the devApp-enableIvy branch 2 times, most recently from 106dc06 to a338aa2 Compare October 21, 2019 19:31
@Splaktar
Copy link
Member Author

OK, hopefully this last push resolves the issues with the public_api_guard and updates the goldens so that everything is finally green.

@Splaktar Splaktar added target: major This PR is targeted for the next major release and removed in progress This issue is currently in progress labels Oct 21, 2019
Copy link
Member

@crisbeto crisbeto left a comment

Choose a reason for hiding this comment

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

LGTM

tools/defaults.bzl Outdated Show resolved Hide resolved
@mmalerba mmalerba added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Oct 21, 2019
- enable Ivy and fix template type checking in Bazel
  - for libraries, examples, dev-app, CI
  - add `postinstall` task for `ivy-ngcc` and configure it for our SystemJS setup
- pin to Angular `9.0.0-next.10` for this PR
  - Angular `9.0.0-next.11` brings in a lot of new template type checking errors
- fix buggy show bounding box checkbox in connected-overlay-demo
- fix stylelint to work with WebStorm plugin
- restrict NodeJS version to 10.x
  - We can't go to NodeJS 12.x without dropping or upgrading Gulp to 4.x
- export `ProgressBarMode` type from `mdc-progress-bar` and `mat-progress-bar`
- export `MatDrawerMode` type from `mat-drawer`
- Add `| null` to `mat-tab-body`'s `@Input() origin: number;`

Fixes #16606. Closes #16373.
@mmalerba mmalerba merged commit db283f1 into master Oct 22, 2019
@mmalerba mmalerba deleted the devApp-enableIvy branch October 22, 2019 18:05
@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 22, 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 cla: yes PR author has agreed to Google's Contributor License Agreement P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful refactoring This issue is related to a refactoring target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stepper: Type 'FormGroup' is not assignable to type 'FormControlLike'
6 participants