@@ -26,7 +26,7 @@ declare namespace Joi {
26
26
27
27
type BasicType = boolean | number | string | any [ ] | object | null ;
28
28
29
- type LanguageMessages = Record < string , string | Record < string , string > > ;
29
+ type LanguageMessages = Record < string , string | Expression | Record < string , string | Expression > > ;
30
30
31
31
type PresenceMode = 'optional' | 'required' | 'forbidden' ;
32
32
@@ -641,6 +641,10 @@ declare namespace Joi {
641
641
render ?: boolean ;
642
642
}
643
643
644
+ interface ExpressionOptions extends ReferenceOptions {
645
+ functions : Record < string , ( ...args : unknown [ ] ) => unknown >
646
+ }
647
+
644
648
interface StringRegexOptions {
645
649
/**
646
650
* optional pattern name.
@@ -1987,6 +1991,8 @@ declare namespace Joi {
1987
1991
toString ( ) : string ;
1988
1992
}
1989
1993
1994
+ interface Expression { }
1995
+
1990
1996
type ExtensionBoundSchema = Schema & SchemaInternals ;
1991
1997
1992
1998
interface RuleArgs {
@@ -2260,7 +2266,7 @@ declare namespace Joi {
2260
2266
/**
2261
2267
* Generates a dynamic expression using a template string.
2262
2268
*/
2263
- expression ( template : string , options ?: ReferenceOptions ) : any ;
2269
+ expression ( template : string , options ?: ExpressionOptions ) : Expression ;
2264
2270
2265
2271
/**
2266
2272
* Creates a new Joi instance customized with the extension(s) you provide included.
@@ -2324,8 +2330,9 @@ declare namespace Joi {
2324
2330
2325
2331
/**
2326
2332
* Generates a dynamic expression using a template string.
2333
+ * @see {@link Root.expression }
2327
2334
*/
2328
- x ( template : string , options ?: ReferenceOptions ) : any ;
2335
+ x ( template : string , options ?: ExpressionOptions ) : Expression ;
2329
2336
2330
2337
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
2331
2338
// Below are undocumented APIs. use at your own risk
0 commit comments