Type guards should not affect values of type any

This PR changes type guards to not affect values of type any.

Fixes #1426.

I've gotten rid of the confusing TypeFlags.Structured flag and just inlined the actual flags in the few cases it was used. I think isStructuredType is a fine name for what it does and the comment on the function explains it further.