I am trying to build some validation for a custom TS Type, like this:
export type Calendar = {
active: boolean;
businessDay: string[];
displayName: string;
holiday: Holiday[];
label: string;
};
export const isValidCalendar = (calendar: Calendar) =>
allPass([
pipe(prop<string, string>('label'), isNil, not),
pipe(prop<string, string>('displayName'), isNil, not),
])(calendar);
But apparently I cannot apply (calendar) to my allPass, due to this error:
Argument of type '[Calendar]' is not assignable to parameter of type 'Record<string, string> & Record<string, string[]>'. Type '[Calendar]' is not assignable to type 'Record<string, string>'. Index signature for type 'string' is missing in type '[Calendar]'.ts(2345)
Why is this happening? How can I solve it?