-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Incorrect Recursive Union Emmission #31605
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
Comments
The typechecking is correct - the declaration emit is just wrong. #31544 should fix this. |
So in the "actual behavior" from the original post, console.log(p3.result.one, p3.result.two, p3.result.three) // error p3.result.two is not ... that error message is made up? I just can't trust people on the Internet! 😒 |
That's the error you get if your consume our current declaration output - since every type variable is named |
Right, it just occurred to me that the actual issue is something like... you emit a declaration file for the first bit and then use those declarations with the collision-named types and fun times happen. Trust in Internet people restored! I'm going to go send some money to that Nigerian prince! |
I'm glad my trust is restored! Sorry I was a bit behind in replying, but thanks everyone for picking up the slack! 31544 does look like it would resolve the issue to me. It seems like there is a need for some kind of pointer or reference in type emissions so that cases like recursion could be followed the by the type checker the same was as they would be followed by interpreting the original code. Does anyone know if that idea has that already been discussed anywhere I could follow along? |
The checker is actually what is converting the type into the node tree. It just wasn't picking good names for the nodes it manufactured, since it wasn't tracking names it'd already used~ |
🎉 🙌 Thanks! |
TypeScript Version: 3.4.5 & typescript@3.5.0-dev.20190525
Search Terms:
Recursive Emit union
Code
Expected behavior:
each depth would produce a unique generic for U
Actual behavior:
Playground Link:
I didn't make this in the playground, but I made a repo for reproduction.
https://github.com/ericwooley/ts-recursive-test
Related Issues:
The text was updated successfully, but these errors were encountered: