You have a utility function that is filtering an object’s properties somehow. Using filterKey will allow your function to filter those properties based on either an array of keys (an allowlist) or a function that returns a boolean for each property.
The KeyFilter type provided by Radashi is fundamental in taking advantage of the filterKey function. Be sure to use it to ensure type safety and maintainable code.
Returns true if the key is in the “keys array” or if the “filter
function” returns true. This function is useful when creating other
functions that need to enumerate an object or array and filter keys
in a flexible manner. Using it directly in everyday code is not
recommended.