fix(core): inspect longs as strings

This commit is contained in:
alina 🌸 2024-05-05 21:00:32 +03:00
parent e9d5158451
commit c021f64ed0
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -1,6 +1,8 @@
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument */
import Long from 'long'
import { getPlatform } from '../../platform.js'
const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom')
@ -57,6 +59,8 @@ export function makeInspectable<T>(
if (val && typeof val === 'object') {
if (val instanceof Uint8Array) {
val = getPlatform().base64Encode(val)
} else if (Long.isLong(val)) {
val = val.toString()
} else if (typeof val.toJSON === 'function') {
val = val.toJSON(true)
}