From 31f2c3d09011687fd80d7b493cc25dc87935ceef Mon Sep 17 00:00:00 2001 From: CPD MSBench Runner Date: Mon, 25 May 2026 20:59:12 +0000 Subject: [PATCH] fix: add input validation to add function - Validate that arguments are finite numbers - Throw descriptive error for invalid inputs Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/math.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/math.ts b/src/math.ts index 8d9b8a2..03f13db 100755 --- a/src/math.ts +++ b/src/math.ts @@ -1,3 +1,6 @@ export function add(a: number, b: number): number { + if (!Number.isFinite(a) || !Number.isFinite(b)) { + throw new Error("Arguments must be finite numbers"); + } return a + b; }