You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like the new Stricter Assignability Checks to Unions with Index Signatures in 3.8 makes it impossible to have data-* props passed to React components when their props type is based on a union.
Pardon the contrived example below (I tried to reduce as much as possible for clarity sake). For a real case most material UI components props types are using unions and therefor fail the same test.
TypeScript Version: 3.8-Beta
Search Terms:
data
Stricter Assignability Checks to Unions with Index Signatures
Expected behavior:
The data- props should be accepted all the time (3.7 behaviour)
Actual behavior:
With 3.8 any extra data-* will be rejected if the props type is based on a union.
@orta it would be great. If the fix it is not making it in a patch release for the 3.8 we will have to skip the whole minor. I can imagine that we are not the only ones in this case. This is not uncommon for people to use data-* in React, especially peeps using Cypress where it is even considered a best practice.
I've heard two reports of this so far, might be worth including in a 3.8 patch also
This affects Elastic UI as well; similar to Material UI we have a number of components whose props are unions. If this break is not fixed in 3.8 it not only affects our Elastic&Material UI projects directly but also blocks any downstream consumers from using TypeScript 3.8 + these component libraries.
Seems like the new Stricter Assignability Checks to Unions with Index Signatures in 3.8 makes it impossible to have
data-*
props passed to React components when their props type is based on a union.Pardon the contrived example below (I tried to reduce as much as possible for clarity sake). For a real case most material UI components props types are using unions and therefor fail the same test.
TypeScript Version: 3.8-Beta
Search Terms:
data
Stricter Assignability Checks to Unions with Index Signatures
Expected behavior:
The
data-
props should be accepted all the time (3.7 behaviour)Actual behavior:
With 3.8 any extra
data-*
will be rejected if the props type is based on a union.Related Issues:
In another repo, but may be this mui/material-ui#19536 ?
Code
Compiler Options
Playground Link: Provided
The text was updated successfully, but these errors were encountered: