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

Stronger typescript support for deep-object-diff #81

Closed
wants to merge 1 commit into from

Conversation

khelif96
Copy link

deep-object-diff will now type the return type based off of the two objects passed in.

  const result = diff(
    {
      some: "value",
      deep: {
        nested: {
          property: "value",
          array: [1, 2, 3],
        },
      },
    },
    { some: "value", other: 1 }
  );

  result.deep.nested.property; // $ExpectType string
  result.some; // $ExpectType string
  result.other; // $ExpectType number
  result.deep.nested.array; // $ExpectType number[]

`deep-object-diff` will now type the return type based off of the two objects passed in. 

```
  const result = diff(
    {
      some: "value",
      deep: {
        nested: {
          property: "value",
          array: [1, 2, 3],
        },
      },
    },
    { some: "value", other: 1 }
  );

  result.deep.nested.property; // $ExpectType string
  result.some; // $ExpectType string
  result.other; // $ExpectType number
  result.deep.nested.array; // $ExpectType number[]
```
@khelif96
Copy link
Author

Sorry realized this is a Duplicate of #48

@khelif96 khelif96 closed this Apr 12, 2022
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

Successfully merging this pull request may close these issues.

None yet

1 participant