Merging non-Partial with Partial results in Partial
Resolution: Limitation
## Bug Report
When merging a non-Partial with a Partial, the type checker believes the final result is a Partial
```typescript
import { deepmerge } from "deepmerge-ts";
interface Example {
a: string;
b: { c: string };
}
const x: Example = {
a: "test",
b: { c: "test2" },
};
const y: Partial<Example> = {
b: { c: "test3" },
};
export const result = deepmerge(x, y);
// try to access
result.b.c; // 'result.b' is possibly 'undefined'
```
### Expected behavior
I would expect the type of `result` to be `Example`
### Actual behavior
The type of `result` is `Partial<Example>`
### Steps to reproduce
https://codesandbox.io/p/devbox/deepmerge-ts-example-forked-g9dks8
关闭于 2025-02-13 4 条评论