Add ConditionalPaths type#1485
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
|
This is described as the path-aware counterpart of
I'm also not convinced the new type is worth duplicating most of the path-generation logic. If we add this, I think it should be a thin composition over I feel like this is a bit too niche |
This PR:
ConditionalPaths<Type, Condition, Options>- the path-aware counterpart ofConditionalKeys. Returns a union of all dot-notation paths in an object whose value type satisfiesCondition.ConditionalPaths#1328Supports:
extendsmode (default): value assignable toConditionequalitymode: exact type match viaIsEqualPathsoptions exceptleavesOnly(which is a no-op for any specific-type condition since primitive-typed fields are always leaves)