Skip to content

Commit

Permalink
fix(🐛): fix TS signature for vec.create() and vec.createValue() (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Apr 22, 2020
1 parent 7b1d93e commit 5f70038
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/Vectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export interface Vector<
y: T;
}

const create = <T extends Animated.Adaptable<number>>(x?: T, y?: T) => ({
x: x || 0,
y: y || x || 0,
const create = <T extends Animated.Adaptable<number>>(x: T, y?: T) => ({
x,
y: y || x,
});

const createValue = (x = 0, y?: number) =>
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/__tests__/Vectors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ test("clamp", () => {
const v1 = vec.create(-1, -1);
const v2 = vec.create(2, 2);
const v3 = vec.create(0.3, 0.2);
const min = vec.create();
const min = vec.create(0);
const max = vec.create(1, 1);
const r1 = vec.createValue();
const r2 = vec.createValue(1, 1);
Expand Down Expand Up @@ -84,7 +84,7 @@ test("single value", () => {
const v1 = -1;
const v2 = 2;
const v3 = vec.create(0.3, 0.2);
const min = vec.create();
const min = vec.create(0);
const max = vec.create(1, 1);
const r1 = vec.createValue();
const r2 = vec.createValue(1, 1);
Expand Down

0 comments on commit 5f70038

Please sign in to comment.