Skip to content

Conversation

@GerkinDev
Copy link

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

@GerkinDev GerkinDev force-pushed the chore/expressions-types branch from e695b8e to 35d2411 Compare February 17, 2025 12:42
@Marsup
Copy link
Collaborator

Marsup commented Apr 2, 2025

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 Marsup added the types TypeScript type definitions label Apr 2, 2025
@Marsup Marsup self-assigned this Apr 2, 2025
@davidjamesstone
Copy link

@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.

@GerkinDev
Copy link
Author

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

@Marsup Marsup force-pushed the chore/expressions-types branch from 8673c3e to 7a79df0 Compare May 14, 2025 09:22
@Marsup
Copy link
Collaborator

Marsup commented May 14, 2025

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

@Marsup
Copy link
Collaborator

Marsup commented May 14, 2025

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.

@GerkinDev GerkinDev force-pushed the chore/expressions-types branch from 7a79df0 to d782e4f Compare August 5, 2025 13:17
@GerkinDev
Copy link
Author

What shouldn't be exposed ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

types TypeScript type definitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants