executing below line gives me Error:(288, 25) TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'CreateValidateObjectType | ((param: string) => CreateValidateObjectType)' has no compatible call signatures.
validationMap[FORM_ELEMENTS_NAMES.LAST_NAME_INPUT]('aaaa')
Here is the validationMap
and its type
type ValidationMapType = {
[key: string]: CreateValidateObjectType | ((param: string) => CreateValidateObjectType);
};
const validationMap: ValidationMapType = {
[FORM_ELEMENTS_NAMES.FIRST_NAME_INPUT]: createValidationObject({
required: true,
minLength: 2,
maxLength: 25,
}),
[FORM_ELEMENTS_NAMES.LAST_NAME_INPUT]: (param: string) => createValidationObject({
required: true,
minLength: 2,
maxLength: 25,
})
}
Calling validationMap
not as a function is not giving me any errors.