-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
styled-components hits instantiation limit after re-aliasing support (#42284) #42320
Comments
I took a look at this. There's definitely a latent circularity in the I'm not sure why this doesn't trigger in 4.1, but it is undoubtedly because we are worse at preserving type aliases and therefore less precise in inference. I can make the issue go away by removing the first overload of |
Very off-topic, but I would be very interested in a “look over your shoulder” session where you debug such an issue and learn the tricks/tooling you apply/use to unwrap the issue. I tend to find solutions for most issues I’m faced with if I keep at it long enough, but my blunt approaches feel very unscientific and leave me wondering how the ‘pros’ solve them. |
I have some insight on why this regressed: Because of a scenario where we fail to preserve an alias where we used to. To start, this wasn't an error before because it hit up our alias-comparison machinery in inference, rather than a structural inference, which, in addition to performing inferences quickly, prevents us from needing to eagerly resolving the structure of the object. As for why we preserved the alias before... It's a long story. We have a type like type AnyStyledComponent = StyledComponent<any, any, any, any> | StyledComponent<any, any, any>; where So the question then becomes "at what point during checking did we lose alias data"? To which the answer is, "when we called So the fix for this on our side is actually quite small, and I now have a PR up at #42430. |
This is very likely because there are more type identities than before. I'm not sure whether the fix will have to be here or on the styled-components types.
The text was updated successfully, but these errors were encountered: