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
If you hover over Concatenated, you can see that its type is type Concatenated = "a-0" | "a-2" | "a-1" | "b-0" | "b-2" | "b-1" | "c-0" | "c-2" | "c-1".
π Expected behavior
The expected type should instead be type Concatenated = "a-0" | "b-1" | "c-2".
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
TS doesn't have direct support for correlated unions as described in #30581. The only support is for generics of the form described at #47109, which is kind of yucky for a case like this:
Thank you so much for your detailed help, @jcalz! π
I initially tried to get the result "a-0" | "b-1" | "c-2" with another Playground, though I can see why this other approach gives the wider result "a-0" | "a-2" | "a-1" | "b-0" | "b-2" | "b-1" | "c-0" | "c-2" | "c-1". Is there a way to get the narrower result along the lines of this approach? Or would the solution you shared above be the simplest way to achieve this?
π Search Terms
TypeScript Playground Link
π Version & Regression Information
Unknown
β― Playground Link
https://www.typescriptlang.org/play/?#code/MYewdgzgLgBACgQQJICUDKMC8MDaAoGQ3AcgENiAaGABgF0KCidiAjSmARnscOeHYBM3WjFIQYoSFADcePJOgwAwgHkAckoQAVAKJrtOgCJZ4ydADoAtqQAOACgBupADYBXAKZYAfDAAGAEgBvJzd3HDoAXwBaIJCPHC4I31FxBSgASlk8KABPG08lcGBSKHcwEvcAExM7XPyQADNldU1dfV1DdJwwV0sWdwAnWlkgA
π» Code
π Actual behavior
If you hover over
Concatenated
, you can see that its type istype Concatenated = "a-0" | "a-2" | "a-1" | "b-0" | "b-2" | "b-1" | "c-0" | "c-2" | "c-1"
.π Expected behavior
The expected type should instead be
type Concatenated = "a-0" | "b-1" | "c-2"
.Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: