use direct result of switch type assertion

use direct result of switch type assertion.