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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerializeFrom with nested 'data' props replaces parent entries causing type loss #5288

Closed
1 task done
milamer opened this issue Jan 27, 2023 · 1 comment
Closed
1 task done

Comments

@milamer
Copy link

milamer commented Jan 27, 2023

What version of Remix are you using?

1.11.1

Are all your remix dependencies & dev-dependencies using the same version?

  • Yes

Steps to Reproduce

When using the SerializeFrom function to convert a nested data object to a serialized version, any nested data props within the object will replace all entries of the parent. This results in the parent object having the type of the nested data object, rather than preserving the original type of the parent. This can lead to unexpected behavior and loss of information.

An example of this issue can be seen in the following code:

type NestedDataObject = {
  value: string
  // can also be deeper nested
  data: {
    test: string
  }
}

type SerializedData = SerializeFrom<NestedDataObject>

// SerializedData has the entries of data
const TestImpl: SerializedData = {
  test: 'test',
}

Expected Behavior

In the example above, the SerializedData type should have both value and data entries.

Actual Behavior

It only has the entries of data.

@machour
Copy link
Collaborator

machour commented Jan 28, 2023

Duplicate of #5211

@machour machour marked this as a duplicate of #5211 Jan 28, 2023
@machour machour closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants