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

Merge vs MergeAll #247

Closed
OrahKokos opened this issue Jul 27, 2021 · 1 comment
Closed

Merge vs MergeAll #247

OrahKokos opened this issue Jul 27, 2021 · 1 comment
Labels
wontfix This will not be worked on

Comments

@OrahKokos
Copy link

馃悶 Bug Report

Describe the bug

Inconsistent behavior between Merge and MergeAll

Reproduce the bug

type Base = {
  base: 'base'
}

type withX = {
  x: number
}

type withY = {
  y: number
}
type Common = O.Merge<Base, { type: TYPES.TYPE1 }>
type Type1Fields = O.MergeAll<{}, [withX, withY]>

// Not good
type Type1A = O.MergeAll<Common, [O.Partial<Type1Fields>, O.Record<PropertyKey, unknown>]>
//  type Type1A = {
//    [x: string]: unknown;
//    [x: number]: unknown;
//    base: 'base';
//    type: TYPES.TYPE1;
//    x?: unknown; <------ Should not be modified
//    y?: unknown; <------ Should not be modified
//  }

type Type1B = O.Merge<
  O.Merge<
    Common,
    O.Partial<Type1Fields>
  >,
  O.Record<PropertyKey, unknown>
>
//  type Type1B = {
//    [x: string]: unknown;
//    [x: number]: unknown;
//    base: 'base';
//    type: TYPES.TYPE1;
//    x?: number | undefined; <---- Good
//    y?: number | undefined; <---- Good
// }

Expected behavior

Marge all should produce the same result as chaining merges one by one.

Possible Solution

Screenshots

Example provided.

Additional context

@stale
Copy link

stale bot commented Oct 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Oct 2, 2021
@stale stale bot closed this as completed Oct 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant