mergician
mergician copied to clipboard
Add support for Inferring types
First off, great library. My request is that mergician would infer the type of the object passed in, or at least allow a generic
From the types definition, I see this:
export function mergician(...objects: object[]): object;
So the result is always of type object
. But it would be nice if we could do this:
const obj1: MyType = { ... };
const obj2: Partial<MyType> = { ... };
const newObject1 = mergician(obj1, obj2); // newObject1 is now of type MyType
const newObject2 = mergician<MyType>({}, obj1); // newObject2 is cast as MyType