1
votes

I've this function working fine:

 SFcopy = _.omit(SFcopy, (objectValue: any, objectField: string): boolean => {
            return (
                !defaultSF.hasOwnProperty(objectField) ||
                _.isEqual(defaultSF[objectField], objectValue)
            );
         });

but when I updated angular to 6 the function stopped working and it shows me the following error that I do not know how to fix

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

enter image description here

LODASH version(update to the last version doesn't work):

"lodash": "^4.17.4",
"@types/lodash": "^4.14.62",

Can you help me to fix it?

Thank you.

1
i think it is bcoz objectValue has a type any change it to boolean it may work - Chellappan வ
or remove the boolean from here _.omit(SFcopy, (objectValue: any, objectField: string) - Chellappan வ
I tried both, but it does not work - Fabio Venturi Pastor

1 Answers

3
votes

_.omit was changed in Lodash 4. Now the predicate version is extracted and renamed to _.omitBy. Change it to _.omitBy and it should work as before.