eliminate redundant typeof val