When attempting to run "node_modules/.bin/ngc" -p tsconfig-aot.json which is the NGC command to compile an AoT application i get these following errors and don't really understand why they're being spit out.
$ "node_modules/.bin/ngc" -p tsconfig-aot.json
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/app.component.ts:15:11: Parameter 'theme' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/navmenu.component.ts:14:11: Parameter 'theme' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.general.ts:135:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.general.ts:140:32: Parameter 'index' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.general.ts:199:10: Parameter 'type' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.general.ts:204:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.general.ts:241:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.custom.ts:39:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.custom.ts:93:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.dynamic.ts:47:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.dynamic.ts:122:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.dynamic.ts:156:18: Parameter 'selectedType' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.message.ts:39:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.message.ts:92:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.security.ts:28:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.security.ts:110:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/edit.dashboard.security.ts:140:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/admin.dashboard.component.ts:102:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/admin.dashboard.component.ts:119:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/user.dashboard.component.ts:71:64: Parameter 'a' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/user.dashboard.component.ts:71:67: Parameter 'b' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/src/app/save.dashboard.component.ts:134:23: Parameter 'message' implicitly has an 'any' type.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:191:43: Property 'newDashboard' is private and only accessible within class 'AdminDashboardComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:319:40: Property 'selectedDash' does not exist on type 'NewDashboardDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:323:39: Property 'pressSubmit' is private and only accessible within class 'NewDashboardDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:323:55: Property 'selectedDash' does not exist on type 'NewDashboardDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:358:39: Property 'pressSubmit' is private and only accessible within class 'NewDashboardDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:358:55: Property 'selectedDash' does not exist on type 'NewDashboardDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/admin.dashboard.component.ngfactory.ts:389:32: Property 'selectedDash' does not exist on type 'NewDashboardDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:628:43: Property 'pressAddFields' is private and only accessible within class 'EditDashboardGeneralComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:693:43: Property 'pressAddStatic' is private and only accessible within class 'EditDashboardGeneralComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:943:40: Property 'newFieldName' does not exist on type 'AddDashFieldDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:947:39: Property 'pressSubmit' is private and only accessible within class 'AddDashFieldDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:947:55: Property 'newFieldName' does not exist on type 'AddDashFieldDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:1007:43: Property 'pressSubmit' is private and only accessible within class 'AddDashFieldDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:1007:59: Property 'newFieldName' does not exist on type 'AddDashFieldDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.general.ngfactory.ts:1038:32: Property 'newFieldName' does not exist on type 'AddDashFieldDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.custom.ngfactory.ts:134:43: Property 'pressAdd' is private and only accessible within class 'EditDashboardCustomComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.custom.ngfactory.ts:150:43: Property 'pressDelete' is private and only accessible within class 'EditDashboardCustomComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.custom.ngfactory.ts:679:43: Property 'pressSubmit' is private and only accessible within class 'AddCustomDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.custom.ngfactory.ts:718:39: Property 'pressSubmit' is private and only accessible within class 'AddCustomDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:178:43: Property 'pressAdd' is private and only accessible within class 'EditDashboardDynamicComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:194:43: Property 'pressDelete' is private and only accessible within class 'EditDashboardDynamicComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:405:43: Property 'pressEditProperties' is private and only accessible within class 'EditDashboardDynamicComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:611:43: Property 'pressSubmit' is private and only accessible within class 'AddDynamicDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:648:39: Property 'pressSubmit' is private and only accessible within class 'AddDynamicDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:845:40: Property 'newEndpoint' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:954:40: Property 'newUsername' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1031:44: Property 'newPassword' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1152:64: Property 'newDashName' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1152:80: Property 'newDashType' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1177:64: Property 'newDashName' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1177:80: Property 'newDashType' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1207:36: Property 'newEndpoint' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1215:36: Property 'newUsername' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.dynamic.ngfactory.ts:1219:36: Property 'newPassword' does not exist on type 'AddEditRestDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:139:43: Property 'pressAdd' is private and only accessible within class 'EditDashboardMessageComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:155:43: Property 'pressDelete' is private and only accessible within class 'EditDashboardMessageComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:645:44: Property 'newMessageName' does not exist on type 'AddMessageDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:649:43: Property 'pressSubmit' is private and only accessible within class 'AddMessageDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:649:59: Property 'newMessageName' does not exist on type 'AddMessageDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:684:39: Property 'pressSubmit' is private and only accessible within class 'AddMessageDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:684:55: Property 'newMessageName' does not exist on type 'AddMessageDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.message.ngfactory.ts:715:32: Property 'newMessageName' does not exist on type 'AddMessageDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:137:43: Property 'pressAddAdmin' is private and only accessible within class 'EditDashboardSecurityComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:153:43: Property 'pressDeleteAdmin' is private and only accessible within class 'EditDashboardSecurityComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:207:43: Property 'pressAddUser' is private and only accessible within class 'EditDashboardSecurityComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:223:43: Property 'pressDeleteUser' is private and only accessible within class 'EditDashboardSecurityComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:346:44: Property 'newAdmin' does not exist on type 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:350:43: Property 'pressSubmit' is private and only accessible within class 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:350:59: Property 'newAdmin' does not exist on type 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:387:39: Property 'pressSubmit' is private and only accessible within class 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:387:55: Property 'newAdmin' does not exist on type 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:420:32: Property 'newAdmin' does not exist on type 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:438:32: Property 'newAdmin' does not exist on type 'AddNotificationOneDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:548:44: Property 'newUser' does not exist on type 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:552:43: Property 'pressSubmit' is private and only accessible within class 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:552:59: Property 'newUser' does not exist on type 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:589:39: Property 'pressSubmit' is private and only accessible within class 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:589:55: Property 'newUser' does not exist on type 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:622:32: Property 'newUser' does not exist on type 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/edit.dashboard.security.ngfactory.ts:640:32: Property 'newUser' does not exist on type 'AddNotificationTwoDialog'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/save.dashboard.component.ngfactory.ts:37:39: Property 'pressSave' is private and only accessible within class 'SaveDashboardComponent'.
Error at C:/Users/DTurcich/Source/Repos/Interns/DashboardConsole/ASCI.DashboardConsole.Frontend/aot/src/app/save.dashboard.component.ngfactory.ts:57:43: Property 'pressCancel' is private and only accessible within class 'SaveDashboardComponent'.
Pertinent files for AoT
tsconfig-aot.json
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [ "es2015", "dom" ],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"../../node_modules/@types/"
]
},
"files": [
"src/app/app.module.ts",
"src/main.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit": true
}
}
main.ts
import { enableProdMode } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';
import { AppModuleNgFactory } from '../aot/src/app/app.module.ngfactory';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
console.log('Running AOT compiled');
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
I want to migrate from JIT to AOT for faster load times and so that when I implement Tree Shaking it's more effective, but i don't know what to do about these errors. Please help
Running the app with ng run --prod
will do the tree-shaking and run the app using AOT compilation.
If you're interested in more details i found their wiki quite useful.
Oh and you can of course use ng build --prod
as well.
Regarding the errors I suggest you start using TS Lint because you're breaking some typescript rules, mostly regarding using private properties outside the class they were declared in and implicit type definitions (not declaring the type, yes even any type).
I highly recommend using JetBrains PHPStorm or WebStorm as your editor they provide a bunch of amazing tools and it's very easy to enable TS Lint inspections in them.
They are not free though.