fix(electron): preserve unrepresentable numeric option evidence

This commit is contained in:
morluto
2026-10-10 01:45:01 +08:00
parent 3e19875c7f
commit 41a228c1b0
2 changed files with 29 additions and 2 deletions
@@ -151,7 +151,11 @@ const literalValue = (
if (
t.isUnaryExpression(node, { operator: "-" }) &&
t.isNumericLiteral(node.argument)
)
return { found: true, value: -node.argument.value };
) {
const value = -node.argument.value;
return Number.isFinite(value) && !Object.is(value, -0)
? { found: true, value }
: { found: false };
}
return { found: false };
};