import { shallowMerge } from 'true-di/utils';
const { shallowMerge } = require('true-di/utils');
function shallowMerge(...sourceObject: object[]): object
export type Merge<T1 extends object, T2 extends object> =
Omit<T1, keyof T2> & T2; // Overriding Join
import diContainer, { factoriesFrom } from 'true-di';
type IContainer1 = {
service11: IService11,
service12: IService12,
}
type IContainer2 = {
service11: IService11,
service12: IService12,
}
const container1 = diContainer<IContainer1>(Object.create(null, {
service11: { enumerable: false, value: () => createService11() },
service12: { enumerable: false, value: () => createService12() },
}));
const container2 = diContainer<IContainer1>(Object.create(null, {
service21: { enumerable: false, value: () => createService21() },
service22: { enumerable: false, value: () => createService22() },
}));
export default diContainer<IContainer1 & IContainer2>(shallowMerge(
factoriesFrom(container1),
factoriesFrom(container2),
));