Skip to content

Allow functions as keys #313

@matt-tingen

Description

@matt-tingen

#261 discusses the issues with the type definitions with nested keys, but the resolution is not type safe. To make it type safe, functions could be allowed as keys (e.g. keys: [item => item.foo.bar]) as described by @ceymard.

This also allows for simplifying the case of searching derived fields such as full name e.g. item => `${item.firstName} ${item.lastName}` which faces issues similar to those described in #302. Obviously, an intermediate object could be used for this, but that seems excessive compared to having functional keys to search.

I'd be happy to implement a PR for this if the behavior is desired.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions