Add $type property to generated message classes, fixes #173