Skip to content

Commit 3982038

Browse files
bfrickaMikeRyanDev
authored andcommitted
fix(omit): Strengthen the type checking of the omit utility function
1 parent 7dbb571 commit 3982038

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

modules/store/src/utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ export function combineReducers(reducers: any, initialState: any = {}): ActionRe
3131
};
3232
}
3333

34-
export function omit(object: { [key: string]: any }, keyToRemove: string) {
34+
export function omit<T extends { [key: string]: any }>(object: T, keyToRemove: keyof T): Partial<T> {
3535
return Object.keys(object)
3636
.filter(key => key !== keyToRemove)
37-
.reduce((result, key) => (<any>result)[key] = object[key], {});
37+
.reduce((result, key) => Object.assign(result, { [key]: object[key] }), {});
3838
}
3939

4040
export function compose<A>(): (i: A) => A;

0 commit comments

Comments
 (0)