Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

U.Merge adds unexpected index signatures when applied to intersection types #309

Open
azhiv opened this issue Jun 16, 2022 · 0 comments
Open

Comments

@azhiv
Copy link

azhiv commented Jun 16, 2022

馃悶 Bug Report

Describe the bug

U.Merge adds unexpected index signatures when applied to intersection types of the same content.

Reproduce the bug

import { Union } from "ts-toolbelt";

type discriminatedUnion = { flag: true } | { flag: false };
type simpleMerge = Union.Merge<discriminatedUnion>;

/* type simpleMerge = { flag: boolean; } */

type complexDiscriminatedUnion = ({ flag: true } | { flag: false }) & ({ flag: true } | { flag: false });
type complexMerge = Union.Merge<complexDiscriminatedUnion>;

/* type complexMerge = {
    [x: string]: undefined;
    [x: number]: undefined;
    [x: symbol]: undefined;
    flag: boolean;
} */

Playground link

Expected behavior

No index signatures are observed in complexMerge.

Possible Solution

Screenshots

Additional context

ts-toolbelt v.9.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant