尝试在Angular 4中编译AoT时出错

时间:2017-06-29 19:36:20

标签: angular typescript angular-aot

当试图运行“node_modules / .bin / ngc”-p tsconfig-aot.json这是编译AoT应用程序的NGC命令时,我得到以下这些错误并且不太明白为什么它们会被吐出来

$ "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'.

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);

我想从JIT迁移到AOT以加快加载时间,因此当我实现Tree Shaking时它更有效,但我不知道如何处理这些错误。请帮忙

2 个答案:

答案 0 :(得分:2)

  • 适用于所有Parameter '***' implicitly has an 'any' type.

tsconfig-aot.json 中,您要求noImplicitAny

因此,在您指定变量而不指定类型时,Typescript会告诉您。

  • 适用于所有Property '***' is private and only accessible within class '***'.

这是因为你有模板html尝试访问私有组件属性。没有AOT编译,它不会抱怨它,因为它是JS,但是使用AOT,它是Typescript,所以检查隐私。

  • 适用于所有Property '***' does not exist on type '***'.

同样,您可以访问模板中的一些属性,这些属性对于Typescript不存在。也许你在JS中做了一些魔术,但是Typescript要严格得多。

答案 1 :(得分:1)

使用#settings-info运行应用程序将进行树震动并使用 AOT 编辑来运行应用程序。

如果您对更多细节感兴趣,我发现他们的 wiki 非常有用。

ng-cli Wiki

哦,你当然可以使用ng run --prod

关于错误,我建议你开始使用TS Lint,因为你打破了一些打字规则,主要是关于在声明它们的类之外使用私有属性和隐式类型定义(不是声明类型,是的甚至任何类型)。
我强烈建议您使用JetBrains PHPStorm WebStorm 作为编辑,他们提供了许多令人惊叹的工具,并且很容易在其中启用TS Lint检查。 /> 他们不是免费的。