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
Expected behavior:
Should compile: A is "x"|"y", B is "x", so A&B is "x".
Actual behavior:
Does not compile: q is of type (ab:never)=>void.
Hovering over the func call in TS Playground shows this: function func<"x" | "y", "x">(a: "x" | "y", b: "x"[]): (ab: never) => void
which suggests both A and B were correctly inferred, but still A&B is wrong.
Another data point: removing extends string requirement on A makes it work (although then B is "x"|"y"). Also if func takes b:B (not array) as second argument, then it works.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.6.1
Code
Expected behavior:
Should compile:
A
is"x"|"y"
,B
is"x"
, soA&B
is"x"
.Actual behavior:
Does not compile:
q
is of type(ab:never)=>void
.Hovering over the func call in TS Playground shows this:
function func<"x" | "y", "x">(a: "x" | "y", b: "x"[]): (ab: never) => void
which suggests both
A
andB
were correctly inferred, but stillA&B
is wrong.Another data point: removing
extends string
requirement onA
makes it work (although thenB
is"x"|"y"
). Also if func takesb:B
(not array) as second argument, then it works.The text was updated successfully, but these errors were encountered: