Skip to content

Commit 0934f1f

Browse files
authored
debt - handle BigInt in safeStringify (microsoft#210220)
1 parent ccd48cf commit 0934f1f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/vs/base/common/objects.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@ export function safeStringify(obj: any): string {
177177
seen.add(value);
178178
}
179179
}
180+
if (typeof value === 'bigint') {
181+
return `[BigInt ${value.toString()}]`;
182+
}
180183
return value;
181184
});
182185
}

src/vs/base/test/common/objects.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ suite('Objects', () => {
113113
c: [
114114
obj1, obj2
115115
],
116-
d: null
116+
d: null,
117+
e: BigInt(42)
117118
};
118119

119120
arr.push(circular);
@@ -135,7 +136,8 @@ suite('Objects', () => {
135136
},
136137
'[Circular]'
137138
],
138-
d: [1, '[Circular]', '[Circular]']
139+
d: [1, '[Circular]', '[Circular]'],
140+
e: '[BigInt 42]'
139141
});
140142
});
141143

0 commit comments

Comments
 (0)