Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: remove optional status from KeysByType keys
Because status modifiers are attached to keys, `KeysByType` gives back an `undefined` key when the original object contains optional keys; even if the optional key is not of the given type. This change fixes that by removing the optional status modifier from the object while iterating over the keys. The downside to this change is that it does not perfectly purify the object. So if other status modifiers are added in the future, we will not necessarily be robust to that change. A more "pure" fix (pun intended) would be to work with a purified object. The downside is that the only way I could figure out to do that would require much uglier code and/or a helper function that would need to be exported. In favor of minimizing "private" exports, I opted for the simple solution. Also a downside here is that we cannot filter by `undefined` if a key is optional. This was already an issue before this commit, so I'm punting on it for now because the fix seems non-trivial. Closes #106
- Loading branch information