Skip to content

Commit

Permalink
feat: issue-#57 - type fix
Browse files Browse the repository at this point in the history
- Fix empty type in
  'setTheory' module.
  • Loading branch information
elycruz committed Dec 27, 2024
1 parent 2304ad5 commit 2dcc022
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/fjl/src/object/setTheory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const
objIntersect = <T extends object, T2 extends object>(
obj1: T,
obj2: T2
): { [index in keyof T] } =>
): { [index in keyof T]: any } =>
reduce((agg, key) => {
if (hasOwnProperty(obj2, key)) {
agg[key] = obj2[key];
Expand All @@ -20,24 +20,24 @@ export const
}, {}, keys(obj1)),

$objIntersect = <T extends object, T2 extends object>(obj1: T) =>
(obj2: T2): { [index in keyof T] } => objIntersect(obj1, obj2),
(obj2: T2): { [index in keyof T]: any } => objIntersect(obj1, obj2),

objDifference = <T extends object, T2 extends object>(obj1: T, obj2: T2): { [index in keyof T] } =>
objDifference = <T extends object, T2 extends object>(obj1: T, obj2: T2): { [index in keyof T]: any } =>
reduce((agg, key: string) => {
if (!hasOwnProperty(obj2, key)) {
agg[key] = obj1[key];
}
return agg;
}, {} as { [index in keyof T] }, keys(obj1)),
}, {} as { [index in keyof T]: any }, keys(obj1)),

$objDifference = <T extends object, T2 extends object>(obj1: T) =>
(obj2: T2): { [index in keyof T] } => objDifference(obj1, obj2),
(obj2: T2): { [index in keyof T]: any } => objDifference(obj1, obj2),

objComplement = <T extends object, T2 extends object>(obj0: T, ...objs: T2[]): { [index in keyof T] } =>
objComplement = <T extends object, T2 extends object>(obj0: T, ...objs: T2[]): { [index in keyof T]: any } =>
reduce((agg, obj) =>
assignDeep(agg, objDifference(obj, obj0)), {} as { [index in keyof T] }, objs),
assignDeep(agg, objDifference(obj, obj0)), {} as { [index in keyof T]: any }, objs),

$objComplement = <T extends object, T2 extends object>(obj0: T) =>
(...objs: T2[]): { [index in keyof T] } => objComplement(obj0, ...objs)
(...objs: T2[]): { [index in keyof T]: any } => objComplement(obj0, ...objs)

;

0 comments on commit 2dcc022

Please sign in to comment.