joi icon indicating copy to clipboard operation
joi copied to clipboard

chore: improve expression types

Open GerkinDev opened this issue 9 months ago • 5 comments

Joi.expression did not accept functions record, and returned any.

GerkinDev avatar Feb 17 '25 12:02 GerkinDev

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 avatar Apr 02 '25 09:04 Marsup

@Marsup this PR fixes this issue with the types around LanguageMessages and Expressions.

image

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.

davidjamesstone avatar Apr 15 '25 11:04 davidjamesstone

I added the test. It fixes what @davidjamesstone mentioned, so it closes #3064

GerkinDev avatar Apr 28 '25 15:04 GerkinDev

I'm not yet sure what's the problem with the tests, the error line doesn't match, I'm investigating.

Marsup avatar May 14 '25 09:05 Marsup

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.

Marsup avatar May 14 '25 09:05 Marsup

What shouldn't be exposed ?

GerkinDev avatar Aug 05 '25 13:08 GerkinDev