Closed st-clair-clarke closed 1 year ago
export const messages = ({id, subject='', minLength, maxLength}: TValidationMessage) =>
match( id )
.returnType<string | null>()
.with('maxStringLength', () => maxStringLengthMessage( { id, subject, maxLength })
.with( 'minStringLength', () => minStringLengthMessage( { id, subject, minLength })
.otherwise(() => null)
Thanks
I have the following:
If a match is successful, a string is returned. If it is not successful I would like null to be returned. I could return null in the .otherwise(), but then I would loose the specific specific message, which I don't want either.