Skip to content

Commit

Permalink
fix(omit): Strengthen the type checking of the omit utility function
Browse files Browse the repository at this point in the history
  • Loading branch information
bfricka authored and MikeRyanDev committed Jul 12, 2017
1 parent 7dbb571 commit 3982038
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/store/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ export function combineReducers(reducers: any, initialState: any = {}): ActionRe
};
}

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

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

0 comments on commit 3982038

Please sign in to comment.