We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
if()
I was expected the following validation code to work, based on https://github.com/bodinsamuel/altheia/blob/master/Documentation.md#if-test-func-then-func-otherwise-func- and https://github.com/bodinsamuel/altheia/blob/master/test/base.test.js#L133:
alt.any().if({ test: test => test.array(), then: test => test .array() .min(1) .oneOf(alt.string()), otherwise: test => test.boolean(), }),
... but the test => test.array() expression ends up throwing a test.array is not a function error.
test => test.array()
test.array is not a function
I'm guessing that any() should return an object that still allows type checking methods like array().
any()
array()
The text was updated successfully, but these errors were encountered:
Thanks for the report !
You are right that the chaining imply same type but it's optional, this should work better:
alt.any().if({ test: () => alt.array(), then: () => alt.array().min(1).oneOf(alt.string()), otherwise: () => alt.boolean(), })
Anyway this if is poorly design. I will create a better oneOf for all types that should cover all use cases.
if
oneOf
Sorry, something went wrong.
No branches or pull requests
I was expected the following validation code to work, based on https://github.com/bodinsamuel/altheia/blob/master/Documentation.md#if-test-func-then-func-otherwise-func- and https://github.com/bodinsamuel/altheia/blob/master/test/base.test.js#L133:
... but the
test => test.array()
expression ends up throwing atest.array is not a function
error.I'm guessing that
any()
should return an object that still allows type checking methods likearray()
.The text was updated successfully, but these errors were encountered: