handle return with no value as type undefined