How to get the error message to contain 'nonempty' refinement when a 'pattern' is used

Author: st-clair-clarkeCreated Dec 2, 2024Updated Dec 2, 2024

I have the following:

NameStruct {
   first: nonempty(size( pattern( string(), nounRegex()as RegExp), 2, 20)),
}

When the first property is empty (''), it is the pattern error that is generated

{key: 'first', message: 'At path: first -- Expected a string matching `/^[A-Za-z\' -]+$/` but received ""', refinement: 'pattern', value: ''}
key
: 
"first"
message
: 
"At path: first -- Expected a string matching `/^[A-Za-z' -]+$/` but received \"\""
refinement
: 
"pattern"
value
: 
""

How can I get the error message to show the 'nonempty' refinement

NB. I am actually attempting to make a text input required.

Source: ianstormtaylor/superstruct