mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
[@types/hapi__joi]: fix SchemaInternals.$_getRule return type (#45552)
* Adds GetRuleOptions type * Fixes return type of SchemaInternal.$_getRule to return optional GetRuleOptions object, previously array
This commit is contained in:
parent
1fcf2f98a0
commit
e39b0ad3bb
@ -1159,6 +1159,13 @@ schema = Joi.symbol().map({
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
const rule = Joi.string().case('upper').$_getRule('case');
|
||||
if (rule && rule.args) {
|
||||
const direction = rule.args.direction;
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.any();
|
||||
const terms = schema.$_terms;
|
||||
|
||||
|
||||
9
types/hapi__joi/index.d.ts
vendored
9
types/hapi__joi/index.d.ts
vendored
@ -726,6 +726,13 @@ declare namespace Joi {
|
||||
};
|
||||
}
|
||||
|
||||
interface GetRuleOptions {
|
||||
args?: Record<string, any>;
|
||||
method?: string;
|
||||
name: string;
|
||||
operator?: string;
|
||||
}
|
||||
|
||||
interface SchemaInternals {
|
||||
/**
|
||||
* Parent schema object.
|
||||
@ -767,7 +774,7 @@ declare namespace Joi {
|
||||
/**
|
||||
* Retrieve some rule configuration.
|
||||
*/
|
||||
$_getRule(name: string): ExtensionRule;
|
||||
$_getRule(name: string): GetRuleOptions | undefined;
|
||||
|
||||
$_mapLabels(path: string | string[]): string;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user