Is there a way to create a function that validates specific fields as required on a particular type?
The IFinancingModel
includes the property statusDetails
, which could potentially be undefined in a valid financing scenario, making the use of Required<>
inappropriate.
export function validateFinancingFields(
financing: IFinancingModel | undefined,
): financing is Required<IFinancingModel> {
return !!(
projectFinancing &&
projectFinancing.applicationId &&
projectFinancing.state
);
}