Customs styles are currently not supporting all possible units and it is not a priority to support more type of data for custom styles.
From the use case, it seems like the value are always going to be in pixels so a float seem appropriate for this. Otherwise, I would recommend using a string and do your own parsing for better error management.