Skip to content

Commit dbcac22

Browse files
committed
remove redundant plain object casts
1 parent 4b0670a commit dbcac22

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

packages/node/src/eventbuilder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function eventFromUnknownInput(exception: unknown, hint?: EventHint): Eve
5757
const message = `Non-Error exception captured with keys: ${extractExceptionKeysForMessage(exception)}`;
5858

5959
getCurrentHub().configureScope(scope => {
60-
scope.setExtra('__serialized__', normalizeToSize(exception as Record<string, unknown>));
60+
scope.setExtra('__serialized__', normalizeToSize(exception));
6161
});
6262

6363
ex = (hint && hint.syntheticException) || new Error(message);

packages/utils/src/object.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,11 +196,10 @@ export function extractExceptionKeysForMessage(exception: any, maxLength: number
196196
*/
197197
export function dropUndefinedKeys<T>(val: T): T {
198198
if (isPlainObject(val)) {
199-
const obj = val as { [key: string]: any };
200199
const rv: { [key: string]: any } = {};
201-
for (const key of Object.keys(obj)) {
202-
if (typeof obj[key] !== 'undefined') {
203-
rv[key] = dropUndefinedKeys(obj[key]);
200+
for (const key of Object.keys(val)) {
201+
if (typeof val[key] !== 'undefined') {
202+
rv[key] = dropUndefinedKeys(val[key]);
204203
}
205204
}
206205
return rv as T;

0 commit comments

Comments
 (0)