fix(form-core): getMessage return type supports string and Element (#1756)

* fix: getMessage return type supports string and Element

* Add changeset
This commit is contained in:
AndreeaMoise 2022-08-10 10:59:12 +02:00 committed by GitHub
parent eac75227ad
commit 0b97918d1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'@lion/form-core': patch
---
Extend type of getMessage to allow it being implemented as a sync function.

View file

@ -27,7 +27,7 @@ export type ValidatorParam = any;
* Will be stored on Validator instance and passed to `execute` function * Will be stored on Validator instance and passed to `execute` function
*/ */
export type ValidatorConfig = { export type ValidatorConfig = {
getMessage?: (data: Partial<FeedbackMessageData>) => Promise<string | Element>; getMessage?: (data: Partial<FeedbackMessageData>) => Promise<string | Element> | string | Element;
type?: ValidationType; type?: ValidationType;
node?: FormControlHost; node?: FormControlHost;
fieldName?: string | Promise<string>; fieldName?: string | Promise<string>;