JSX Attributes should be considered mutable locations #20705
Labels
Bug
A bug in TypeScript
Domain: JSX/TSX
Relates to the JSX parser and emitter
Fixed
A PR has been merged for this issue
Milestone
TypeScript Version: 2.7.0-dev.201xxxxx
We do not perform mutability widening on jsx attributes as we do for object property assignments. Since we do not do the same kind of inference on jsx (and do not have generic jsx return types), this is difficult to witness (since the literal is compatible with its constraint), but is potentially a big performance hit for JSX users that was hidden. The example below is one case where the difference can be witnessed:
Code
Expected behavior:
Bar's quickinfo shows
Bar<string>
on both styles of call - TSame is not constrained tostring
or another literal domain, so its use sites should not be literal locations.Actual behavior:
Bar's quickinfo shows
Bar<"a" | "b">
for the JSX call, butBar<string>
for the normal call.The text was updated successfully, but these errors were encountered: