joi
joi copied to clipboard
chore: improve expression types
Joi.expression did not accept functions record, and returned any.
Thanks for the PR. I'm not exactly sure what it's fixing, maybe it would be worth adding a quick test (in test/index.ts) to ensure there's no regression in the future?
@Marsup this PR fixes this issue with the types around LanguageMessages and Expressions.
The 2nd arg of Joi.expression should allow for a functions map to be passed.
Also, LanguageMessages should allow Joi.expressions as the Record value.
I added the test. It fixes what @davidjamesstone mentioned, so it closes #3064
I'm not yet sure what's the problem with the tests, the error line doesn't match, I'm investigating.
OK, it's because of your render function calls, I'm honestly not sure it should be exposed, as the state is kind of hard to recreate from outside of joi.
What shouldn't be exposed ?