How to solve this type error?

switch dtype {
    | #LAST_DAY_OF_MONTH
    | #MMM_YYYY =>{
      let value = switch dtype.dateValue {
        | Some(a) => a->Date.toString
        | None => ""
        }
        let newDate = parseString(value)->add(15.0,#day)        
         {...dtype, dateValue : parseDate(newDate)}        
    } 
    | _=> 
  }

This has type: t
Somewhere wanted: unit

while checking the condition getting the above error. Here I am trying to convert date value using day js.

You need to return the same type in all switch cases. In your example you return a dtype record in the first case, so I assume in the fallthrough case you want to just return dtype.