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

validate.type.d.ts:15:5 - error TS2411: Property 'id' of type 'string | undefined' is not assignable to string index type 'string | number | boolean | RegExp | ValidatorFn | DValidatorFn'. #78

Closed
smart817 opened this issue Dec 18, 2020 · 2 comments

Comments

@smart817
Copy link

空项目,加载DevUIModule后,编译的时候过不去,不知道别人有遇到没
Error: node_modules/ng-devui/form/validator-directive/validate.type.d.ts:15:5 - error TS2411: Property 'id' of type 'string | undefined' is not assignable to string index type 'string
| number | boolean | RegExp | ValidatorFn | DValidatorFn'.

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

16 validator?: DValidatorFn | ValidatorFn;

@smart817 smart817 changed the title alidate.type.d.ts:15:5 - error TS2411: Property 'id' of type 'string | undefined' is not assignable to string index type 'string | number | boolean | RegExp | ValidatorFn | DValidatorFn'. validate.type.d.ts:15:5 - error TS2411: Property 'id' of type 'string | undefined' is not assignable to string index type 'string | number | boolean | RegExp | ValidatorFn | DValidatorFn'. Dec 18, 2020
@GreatZPP
Copy link
Member

GreatZPP commented Dec 21, 2020

Solved in #77

@wangyaju
Copy link
Member

和问题 #77 重复,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