TypeErrorCannot mix BigInt and other types, use explicit conversions
يعني ايه
جمعت (أو ضربت) BigInt مع Number. اللغة مش بتحوّل بينهم لوحدها.
ليه بيحصل
- رقم عادي دخل في معادلة كلها BigInt.
إزاي تصلّحه
- خلّي الاتنين BigInt (
1n) أو حوّل صراحة بـBigInt(x)أوNumber(x)وانت عارف إن التحويل ممكن يضيّع دقة.
جرّبناه فعلًا
console.log(10n + 1);console.log(10n + 1n);
console.log(Number(10n) + 1);11n
11الدروس اللي بتشرحهnumbers و BigInt