fix(core): inspect longs as strings
This commit is contained in:
parent
e9d5158451
commit
c021f64ed0
1 changed files with 4 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment */
|
/* eslint-disable @typescript-eslint/no-explicit-any,@typescript-eslint/no-unsafe-assignment */
|
||||||
/* eslint-disable @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument */
|
/* eslint-disable @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-argument */
|
||||||
|
|
||||||
|
import Long from 'long'
|
||||||
|
|
||||||
import { getPlatform } from '../../platform.js'
|
import { getPlatform } from '../../platform.js'
|
||||||
|
|
||||||
const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom')
|
const customInspectSymbol = Symbol.for('nodejs.util.inspect.custom')
|
||||||
|
@ -57,6 +59,8 @@ export function makeInspectable<T>(
|
||||||
if (val && typeof val === 'object') {
|
if (val && typeof val === 'object') {
|
||||||
if (val instanceof Uint8Array) {
|
if (val instanceof Uint8Array) {
|
||||||
val = getPlatform().base64Encode(val)
|
val = getPlatform().base64Encode(val)
|
||||||
|
} else if (Long.isLong(val)) {
|
||||||
|
val = val.toString()
|
||||||
} else if (typeof val.toJSON === 'function') {
|
} else if (typeof val.toJSON === 'function') {
|
||||||
val = val.toJSON(true)
|
val = val.toJSON(true)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue