type safe mapping of widget state types