-
-
Notifications
You must be signed in to change notification settings - Fork 197
Open
Labels
enhancementNew feature or requestNew feature or request
Description
There are two common use cases for .is: validation and discrimination.
Typia is often overkill for discrimination due to the amount of code it can generate for something like a JSON Schema type. For discrimination, we often don't need to validate the entire object. If there is a discriminator key, for instance, often all standard TS does is check the value of that key.
Ideally, typia could define a minimal type check to have a discriminator check based on the possible incoming types, but as I think the complexity of that is likely too high, I'm suggesting a MaxDepth param on .is or similar:
typia.is<T, N>
// or a new method to avoid over confidence
typia.isLikely<T, N=2> // 2 seems like a good default
typia.matchesToDepth<T, N=2>Reactions are currently unavailable
Metadata
Metadata
Labels
enhancementNew feature or requestNew feature or request