-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
schematics: verify that generated code passes CLI's stricter compiler flags #17135
Comments
The following should be the current ideal settings (AIO is currently using them) to test against as this will likely be the eventual final state of the CLI's defaults. Note also that many users will enable strict settings as their first step after creating a new project; so ensuring the schematics work in this scenario would also be useful.
|
I'm currently seeing the following compilation errors after enabling these stricter settings in a project that just has Angular Material Schematics in it. ERROR in app/table/table-datasource.ts:107:18 - error TS7006: Parameter 'a' implicitly has an 'any' type.
107 function compare(a, b, isAsc) {
~
app/table/table-datasource.ts:107:21 - error TS7006: Parameter 'b' implicitly has an 'any' type.
107 function compare(a, b, isAsc) {
~
app/table/table-datasource.ts:107:24 - error TS7006: Parameter 'isAsc' implicitly has an 'any' type.
107 function compare(a, b, isAsc) {
~~~~~
app/tree/tree.component.ts:46:7 - error TS2345: Argument of type '(node: FileNode) => Observable<FileNode[] | undefined>' is not assignable to parameter of type '(node: FileNode) => FileNode[] | Observable<FileNode[]> | null | undefined'.
Type 'Observable<FileNode[] | undefined>' is not assignable to type 'FileNode[] | Observable<FileNode[]> | null | undefined'.
Type 'Observable<FileNode[] | undefined>' is not assignable to type 'Observable<FileNode[]>'.
Type 'FileNode[] | undefined' is not assignable to type 'FileNode[]'.
Type 'undefined' is not assignable to type 'FileNode[]'.
46 this.getChildren);
~~~~~~~~~~~~~~~~
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Reproduction
PR angular/angular-cli#14905 introduces a new
strict
option to the Angular CLI. This option is currentlyfalse
by default, but there are plans to make ittrue
in version 9 or 10.Expected Behavior
We need to make sure that all of the code generated by our Schematics will compile with these new flags.
We already use these flags for building the library source and examples.
PR angular/material.angular.io#631 adds these compiler flags for material.angular.io builds as well.
Related Issues
I'm not sure if this is something that we can do in integration tests (#16479) or not. But it seems possible and would be needed to avoid introducing regressions over time.
#13329 tracks making the library code follow even stricter checks (
--strictPropertyInitialization
).#16028 relates to stricter template checks in Ivy.
The text was updated successfully, but these errors were encountered: