From b774084e1500b757cb7fc6abe4bf387e91d78f78 Mon Sep 17 00:00:00 2001 From: Paul Ishenin Date: Tue, 2 Jul 2024 17:26:24 +0700 Subject: [PATCH] fix: handle bigint types separately to int to avoid TypeError with BigInt param --- lib/shared.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/shared.js b/lib/shared.js index 16ef7d79..e302a5f5 100644 --- a/lib/shared.js +++ b/lib/shared.js @@ -57,7 +57,6 @@ const getTypeByValue = function (value) { return TYPES.NVarChar case 'number': - case 'bigint': if (value % 1 === 0) { if (value < -2147483648 || value > 2147483647) { return TYPES.BigInt @@ -68,6 +67,13 @@ const getTypeByValue = function (value) { return TYPES.Float } + case 'bigint': + if (value < -2147483648n || value > 2147483647n) { + return TYPES.BigInt + } else { + return TYPES.Int + } + case 'boolean': for (const item of Array.from(map)) { if (item.js === Boolean) {