-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
property: Add convenience overloads to isValid() #54
Comments
Actually overloading is not needed, we can just do union types instead: export function isValid(
properties: PropertyValueSet.PropertyValueSet | string,
filter: PropertyFilter | string,
comparer: PropertyValue.Comparer = PropertyValue.defaultComparer
): boolean |
Actually it cannot be done by neither union types nor overload since when we have raw strings there is a need for a UPDATE: It is possible to have different number of params in the overloads as long as the implementation supports all permutations. However this is a bit messy to implement because of the optional comparer param. But it should be possible. |
One issue with the overloads is that since they accept a string, the parsing of that string may fail. It then becomes a question how to handle the failures. The two main paths are :
|
Currently we have this:
I propose that we add the possibility to pass unparsed strings to the parameters:
This could be done as overloads of the existing
isValid()
function without a breaking change. Not that I in particular like overloading, but the alternative would be to have 4 separate named versions. I find it hard to come up with good and short names for all 4.The text was updated successfully, but these errors were encountered: