我必须在生产构建之前解决所有TSLint错误吗?

问题描述 投票:0回答:1

即使出现TSlint错误,我也可以在开发模式下运行Angular v8应用程序(下面仅显示了一些)。但是,当我尝试为生产而构建时,它以npm ERR! code ELIFECYCLE npm ERR! errno 2失败。我有很多TSlint错误,有没有一种方法可以在不解决这些错误的情况下进行生产构建?

ERROR in src/main/webapp/app/home/home.component.ts:16:3 - error TS2564: Property 'closeResult' has no initializer and is not definitely assigned in the constructor.

16   closeResult: string;
     ~~~~~~~~~~~

ERROR in src/main/webapp/app/module/authenticated-home/visit-search/visit-search.component.ts:24:40 - error TS2339: Property 'kendoDatePicker' does not exist on type 'JQuery<any>'.

24     $(this.datePickerEl.nativeElement).kendoDatePicker({
                                          ~~~~~~~~~~~~~~~
src/main/webapp/app/module/authenticated-home/visit-search/visit-search.component.ts:25:16 - error TS7006: Parameter 'e' implicitly has an 'any' type.

25       change: (e) => {
                  ~
src/main/webapp/app/module/authenticated-home/advanced-patient-search/advanced-patient-search.component.ts:74:43 - error TS2532: Object is possibly 'undefined'.

74     console.log("type :" + JSON.stringify(this.model.selectedRefIdObj.id));
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~


    npm ERR! code ELIFECYCLE
    npm ERR! errno 2
    npm ERR! [email protected] webpack: `node --max_old_space_size=4096 node_modules/webpack/bin/webpack.js "--config" "webpack/webpack.prod.js" "--profile"`
angular webpack production
1个回答
2
投票

不是TSLint错误,而是打字稿编译错误。对于此错误,您应该在strictPropertyInitialization(和false)中将tsconfig.json设置为tsconfig.app.json

© www.soinside.com 2019 - 2024. All rights reserved.