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
I think the issue here is that variance markers are marking C in Relax as invariant. This is probably caused by #27697 and the extension to variance computation.
Even though TypeScript never ends up relating two conditional types in a way the requires invariance of the check types, the effect of variance computation makes the assignment illegal.
@RyanCavanaugh @weswigham @ahejlsberg Caused by #27697
TypeScript Version: 3.4.0-dev.20190222
Search Terms:
Code
Expected behavior:
pass
Actual behavior:
error
Playground Link: http://www.typescriptlang.org/play/index.html#src=type%20Attrs%20%3D%20Record%3Cstring%2C%20string%20%7C%20EventListener%20%7C%20null%20%7C%20undefined%3E%3B%0D%0Atype%20Children%20%3D%0D%0A%20%20%7C%20Children.Void%0D%0A%20%20%7C%20Children.Text%0D%0A%20%20%7C%20Children.Collection%0D%0A%20%20%7C%20Children.Record%3B%0D%0Anamespace%20Children%20%7B%0D%0A%20%20export%20type%20Void%20%3D%20undefined%3B%0D%0A%20%20export%20type%20Text%20%3D%20string%3B%0D%0A%20%20export%20interface%20Collection%20extends%20ReadonlyArray%3CEl%3E%20%7B%20%7D%0D%0A%20%20export%20type%20Record%20%3D%20%7B%20%5Bfield%3A%20string%5D%3A%20El%3B%20%7D%3B%0D%0A%7D%0D%0Ainterface%20El%3C%0D%0A%20%20T%20extends%20string%20%3D%20string%2C%0D%0A%20%20E%20extends%20Element%20%3D%20Element%2C%0D%0A%20%20C%20extends%20Children%20%3D%20Children%2C%0D%0A%20%20%3E%20%7B%0D%0A%20%20readonly%20tag%3F%3A%20T%3B%0D%0A%20%20readonly%20element%3A%20E%3B%0D%0A%20%20children%3A%20Relax%3CC%3E%3B%0D%0A%7D%0D%0Atype%20Relax%3CC%20extends%20Children%3E%20%3D%20C%20extends%20Children.Text%20%3F%20Children.Text%20%3A%20C%3B%0D%0A%0D%0Adeclare%20function%20f%3CC%20extends%20Children%3E(%20%20%20%20%20%20%20%20%20%20%20%20%20%20children%3A%20C)%3A%20C%3B%0D%0Adeclare%20function%20f%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20(attrs%3A%20Attrs%2C%20%20%20%20%20%20%20%20%20%20%20%20)%3A%20void%3B%0D%0Adeclare%20function%20f%3CC%20extends%20Children%3E(attrs%3A%20Attrs%2C%20children%3A%20C)%3A%20C%3B%0D%0Af(%7B%20a%3A%200%20as%20any%20as%20El%3C'a'%2C%20HTMLAnchorElement%3E%20%7D)%3B%0D%0Af(%7B%20a%3A%200%20as%20any%20as%20El%3C'a'%2C%20HTMLAnchorElement%2C%20Children%3E%20%7D)%3B%0D%0Af(%7B%20a%3A%200%20as%20any%20as%20El%3C'a'%2C%20HTMLAnchorElement%2C%20Children.Void%3E%20%7D)%3B
Related Issues:
The text was updated successfully, but these errors were encountered: