[PATCH v2 07/35] util: typedparam: Refactor and fix typed param validation