diff --git a/src/modules/simulationRenderer/classes/SimulationRenderer.ts b/src/modules/simulationRenderer/classes/SimulationRenderer.ts index ef88e6d..45561ff 100644 --- a/src/modules/simulationRenderer/classes/SimulationRenderer.ts +++ b/src/modules/simulationRenderer/classes/SimulationRenderer.ts @@ -26,6 +26,7 @@ import { GateInitter } from '../types/GateInitter' import { handleMouseDown } from '../helpers/handleMouseDown' import { handleMouseUp } from '../helpers/handleMouseUp' import { handleMouseMove } from '../helpers/handleMouseMove' +import { Gate } from '../../simulation/classes/Gate' export class SimulationRenderer { public mouseDownOutput = new Subject() @@ -117,7 +118,7 @@ export class SimulationRenderer { * @throws SimulationError if an id isnt valid * @throws SimulationError if the id doesnt have a data prop */ - public getSelected() { + public getSelected(): Gate[] { return setToArray(this.allSelectedIds()).map(id => { const gate = this.simulation.gates.get(id) diff --git a/src/modules/vector2/helpers/basic.ts b/src/modules/vector2/helpers/basic.ts index f4192b3..72d0364 100644 --- a/src/modules/vector2/helpers/basic.ts +++ b/src/modules/vector2/helpers/basic.ts @@ -7,7 +7,7 @@ import { vector2 } from '../../../common/math/types/vector2' export const add = (...vectors: vector2[]): vector2 => { const first = vectors[0] const others = vectors.slice(1) - const othersSum = others.length > 1 ? add(...others) : others[0] + const othersSum = others.length >= 1 ? add(...others) : [0, 0] return first.map((value, index) => value + othersSum[index]) as vector2 } @@ -69,4 +69,4 @@ export const inverse = (vector: vector2) => vector.map(a => 1 / a) as vector2 * * @param vectors tHe vectors to find the averege of */ -export const averege = (...vectors: vector2[]) => multiply(add(...vectors), 1 / vectors.length) \ No newline at end of file +export const averege = (...vectors: vector2[]): vector2 => vectors.length ? multiply(add(...vectors), 1 / vectors.length) : [0, 0] \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 0073ddb..7838367 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,12 +3,16 @@ "moduleResolution": "node", "esModuleInterop": true, "jsx": "preserve", - "noImplicitAny": true, "experimentalDecorators": true, "target": "esnext", + "downlevelIteration": true, "strictNullChecks": true, "module": "esnext" }, - "exclude": ["node_modules"], - "include": ["src"] -} + "exclude": [ + "node_modules" + ], + "include": [ + "src" + ] +} \ No newline at end of file