angular 迁移到 6 后 Lodash 忽略不工作
Lodash omit not working after angular migration to 6
我的这个功能运行良好:
SFcopy = _.omit(SFcopy, (objectValue: any, objectField: string): boolean => {
return (
!defaultSF.hasOwnProperty(objectField) ||
_.isEqual(defaultSF[objectField], objectValue)
);
});
但是当我将 angular 更新为 6 时,该功能停止工作并显示以下错误,我不知道如何修复
ERROR in src/app/shared/search-filter.ts(1156,33): error TS2345:
Argument of type '(objectValue: any, objectField: string) => boolean'
is not assignable to parameter of type 'Many'. Type
'(objectValue: any, objectField: string) => boolean' is not assignable
to type 'PropertyKey[]'.
Property 'includes' is missing in type '(objectValue: any, objectField: string) => boolean'.
LODASH 版本(更新到最新版本不起作用):
"lodash": "^4.17.4",
"@types/lodash": "^4.14.62",
你能帮我解决一下吗?
谢谢。
我的这个功能运行良好:
SFcopy = _.omit(SFcopy, (objectValue: any, objectField: string): boolean => {
return (
!defaultSF.hasOwnProperty(objectField) ||
_.isEqual(defaultSF[objectField], objectValue)
);
});
但是当我将 angular 更新为 6 时,该功能停止工作并显示以下错误,我不知道如何修复
ERROR in src/app/shared/search-filter.ts(1156,33): error TS2345: Argument of type '(objectValue: any, objectField: string) => boolean' is not assignable to parameter of type 'Many'. Type '(objectValue: any, objectField: string) => boolean' is not assignable to type 'PropertyKey[]'. Property 'includes' is missing in type '(objectValue: any, objectField: string) => boolean'.
LODASH 版本(更新到最新版本不起作用):
"lodash": "^4.17.4",
"@types/lodash": "^4.14.62",
你能帮我解决一下吗?
谢谢。