diff --git a/client/src/components/formHelpers/form-validators.tsx b/client/src/components/formHelpers/form-validators.tsx index 96ddef7e96c..cab0ac9dc63 100644 --- a/client/src/components/formHelpers/form-validators.tsx +++ b/client/src/components/formHelpers/form-validators.tsx @@ -17,24 +17,25 @@ function isPathRoot(urlString: string): boolean { } } -export const editorValidator = (value: string): React.ReactElement | null => +type Validator = (value: string) => React.ReactElement | null; + +export const editorValidator: Validator = value => editorRegex.test(value) ? validation.editor-url : null; -export const fCCValidator = (value: string): React.ReactElement | null => +export const fCCValidator: Validator = value => fCCRegex.test(value) ? validation.own-work-url : null; -export const localhostValidator = (value: string): React.ReactElement | null => +export const localhostValidator: Validator = value => localhostRegex.test(value) ? ( validation.publicly-visible-url ) : null; -export const httpValidator = (value: string): React.ReactElement | null => +export const httpValidator: Validator = value => httpRegex.test(value) ? validation.http-url : null; -export const pathValidator = (value: string): React.ReactElement | null => +export const pathValidator: Validator = value => isPathRoot(value) ? validation.path-url : null; -type Validator = (value: string) => React.ReactElement | null; export function composeValidators(...validators: (Validator | null)[]) { return (value: string): ReturnType | null => validators.reduce(