Skip to content
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

Angular CLI创建项目引入DevUI后ng build报错。 #77

Closed
Rojac opened this issue Dec 14, 2020 · 2 comments
Closed

Angular CLI创建项目引入DevUI后ng build报错。 #77

Rojac opened this issue Dec 14, 2020 · 2 comments

Comments

@Rojac
Copy link

Rojac commented Dec 14, 2020

当Angular CLI创建项目时,会出现如下提示:
Would you like to add Angular routing?

如果选择Y时,按官网引入DevUI后,ng build会报错。

Error: node_modules/ng-devui/form/validator-directive/validate.type.d.ts:14:5 - error TS2411: Property 'id' of type 'string | undefined' is not assignable to string index type 'string | number | boolean | RegExp | ValidatorFn | DValidatorFn'.
14 id?: string;
~~
node_modules/ng-devui/form/validator-directive/validate.type.d.ts:15:5 - error TS2411: Property 'validator' of type 'ValidatorFn | DValidatorFn | undefined' is not assignable to string index type 'string | number |
boolean | RegExp | ValidatorFn | DValidatorFn'.
15 validator?: DValidatorFn | ValidatorFn;


如果选择N时,按官网引入DevUI后,ng build会警告。

Warning: D:\WorkDir\ISource\Web\WebBSPortal\node_modules\ng-devui_ivy_ngcc_\fesm2015\ng-devui-theme.js depends on 'enquire.js'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: D:\WorkDir\ISource\Web\WebBSPortal\node_modules\ng-devui_ivy_ngcc_\fesm2015\ng-devui-utils.js depends on 'date-fns/format'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Warning: D:\WorkDir\ISource\Web\WebBSPortal\node_modules\ng-devui_ivy_ngcc_\fesm2015\ng-devui-utils.js depends on 'date-fns/parse'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
不知道是否有解决办法?
@GreatZPP
Copy link
Member

经过我们测试,当前使用ng-devui@10版本,在ng/cli@11使用严格模式创建的新项目下,确实会出现以上报错。
当前需要使用,可对应使用Angular10(cli10创建项目),或暂时关闭Angular11下严格模式(等待新版本后打开)。
我们将会尽快处理此问题,发布新版本。

@wangyaju
Copy link
Member

Angular11之后引入了严格模式, TS的checknull对optional参数会默认增加一个undefined类型,导致可选字段和索引字段一起使用时类型不匹配,采用11版本时,暂时关闭严格模式就可以了.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants