issues about type in remove unit.

How can I optimize type related scripts in designing?