Skip to content

Commit

Permalink
Fix for #2874
Browse files Browse the repository at this point in the history
* updated TypeScript definitions
* updated documentation
  • Loading branch information
dariosn85 authored and Marsup committed Jan 15, 2024
1 parent 83c2fa7 commit 5451b3b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ Adds a custom validation function to execute arbitrary code where:
- `state` - the current validation state.
- `prefs` - the current preferences.
- `original` - the original value passed into validation before any conversions.
- `error(code, [local])` - a method to generate error codes using a message code and optional local context.
- `error(code, [local], [localState])` - a method to generate error codes using a message code, optional local context and optional validation local state.
- `message(messages, [local])` - a method to generate an error with an internal `'custom'` error code and the provided messages object to use as override. Note that this is much slower than using the preferences `messages` option but is much simpler to write when performance is not important.
- `warn(code, [local])` - a method to add a warning using a message code and optional local context.

Expand Down
2 changes: 1 addition & 1 deletion lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -738,7 +738,7 @@ declare namespace Joi {
prefs: ValidationOptions;
original: V;
warn: (code: string, local?: Context) => void;
error: (code: string, local?: Context) => ErrorReport;
error: (code: string, local?: Context, localState?: State) => ErrorReport;
message: (messages: LanguageMessages, local?: Context) => ErrorReport;
}

Expand Down

0 comments on commit 5451b3b

Please sign in to comment.