Add TypedThing class, and generalize hasStateType with it.