I have some code for a form:
interface FormProps {
regexPreset?: RegexPresets;
customRegex?: RegExp;
description?: string;
inputTitle: string;
errorMessage?: string;
}
const Form: React.FC<FormProps> = props => {
return <div> somestuff </div>
}
If I pass in a customRegex, I want the compiler to throw an error if errorMessage is not passed (make errorMessage a mandatory property).
The closest thing that I've come to is this StackOverflow post, but I'm unsure whether I can apply this to my use case.
Any pointers would be gladly received.