Previously, spreading an optional any gave a bogus error when the name
conflicted with earlier properties in the object literal. Now the code
checks any types for optionality before issuing the error.
Fixes#37740
* More precise property-overwritten-by-spread errors
Trying to do this check in getSpreadType just doesn't have enough
information, so I moved it to checkObjectLiteral, which is a better
place for issuing errors anyway.
Unfortunately, the approach is kind of expensive in that it
1. creates a new map for each property and
2. iterates over all properties of the spread type, even if it's a
union.
I have some ideas to improve (1) that might work out. I'm not sure how
bad (2) is since we're going to iterate over all properties of all
constituents of a union.
Fixes#36779
* another test and rename
* add tests but not baselines or fixes
* Update original change
Still probably wrong; probably doesn't even compile beacuse I'm just
typing on my laptop.
* fix error code ok
* notes to self
* Error: property is specified more than once via spread
* make jsx tests stricter
* update semicolon error message
* use ?. because it is great
* use maybeTypeOfKind in new code
* restore jsx error
* add tests