Useful or not, from you.
angular-cli Ivy marks unassigned but used child interfaces as unused with compiler warning.

🐞 Bug report

Command (mark with an x)

- [ x] new
- [ x] build
- [ x] serve

Is this a regression?

Yes

Description

Ivy incorrectly identifies interfaces as unused that compose parts of an object returned from an API endpoint. i.e. Type A that contains Type B, if Type B is never assigned to and is in it's own TS file, Ivy generates warnings that Type B is not an entry point.

Workarounds:

  • Move the interface into the same file as the parent object interface.
  • Inline the child interface into the parent interface rather than defining a new type.
  • Define A.B as <any> rather than strongly typing it.

🔬 Minimal Reproduction

https://github.com/fivedice/ivy-warnings See the ReadMe.md for specific example in the repo.

🔥 Exception or Error

<pre><code> WARNING in /Users/jyoutsey/src/fivedice/ivy-warnings/src/app/currency.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig.

WARNING in /Users/jyoutsey/src/fivedice/ivy-warnings/src/environments/environment.prod.ts is part of the TypeScript compilation but it's unused. Add only entry points to the 'files' or 'include' properties in your tsconfig. </code></pre>

🌍 Your Environment

<pre><code> Angular CLI: 9.0.0-next.4 Node: 10.16.0 OS: darwin x64 Angular: 9.0.0-next.6 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router

Package Version

@angular-devkit/architect 0.900.0-next.4 @angular-devkit/build-angular 0.900.0-next.4 @angular-devkit/build-optimizer 0.900.0-next.4 @angular-devkit/build-webpack 0.900.0-next.4 @angular-devkit/core 9.0.0-next.4 @angular-devkit/schematics 9.0.0-next.4 @angular/cli 9.0.0-next.4 @ngtools/webpack 9.0.0-next.4 @schematics/angular 9.0.0-next.4 @schematics/update 0.900.0-next.4 rxjs 7.0.0-alpha.0 typescript 3.7.0-dev.20190918 webpack 4.39.3 </code></pre>

That's a useful answer
Without any help

After activating ivy in my project (Angular 8.2.12) I had those two warnings by calling ng build --aot --prod:

WARNING in [...]src/main.ngsummary.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

WARNING in [...]src/polyfills.ngsummary.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

I fixed by removing the parameter "allowEmptyCodegenFiles": true from angularCompilerOptions in tsconfig.app.json