add const, use Any instead of a large type Union

A huge union like `Union(Dict, Array, String, Number, Bool, Nothing)` is really more trouble than it's worth. Using `Any[]` instead is simpler and might even be faster. Also `TYPES` and `KEY_TYPES` should be `const`.