Skip to content

Commit

Permalink
refactor(geom): update withAttribs() return type
Browse files Browse the repository at this point in the history
  • Loading branch information
postspectacular committed Jan 20, 2019
1 parent 9a50769 commit 8e2c8b5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packages/geom3/src/ops/with-attribs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { Attribs, IShape } from "../api";

export const withAttribs =
(shape: IShape, attribs: Attribs, replace = true) => {
shape.attribs = replace ? attribs : { ...shape.attribs, ...attribs };
return shape;
};
export const withAttribs = <T extends IShape>(
shape: T,
attribs: Attribs,
replace = true
) => {
shape.attribs = replace ? attribs : { ...shape.attribs, ...attribs };
return shape;
};

0 comments on commit 8e2c8b5

Please sign in to comment.