Restrict the return type of value() for generated enum types