diff --git a/packages/core/src/Vectors.ts b/packages/core/src/Vectors.ts index 9dba826b..713dc952 100644 --- a/packages/core/src/Vectors.ts +++ b/packages/core/src/Vectors.ts @@ -15,9 +15,9 @@ export interface Vector< y: T; } -const create = >(x?: T, y?: T) => ({ - x: x || 0, - y: y || x || 0, +const create = >(x: T, y?: T) => ({ + x, + y: y || x, }); const createValue = (x = 0, y?: number) => diff --git a/packages/core/src/__tests__/Vectors.test.ts b/packages/core/src/__tests__/Vectors.test.ts index de9c2ba9..1ab2022b 100644 --- a/packages/core/src/__tests__/Vectors.test.ts +++ b/packages/core/src/__tests__/Vectors.test.ts @@ -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); @@ -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);